Cov txheej txheem:
- Khoom siv
- Kauj ruam 1: Tau Txhua Yam Teeb
- Kauj Ruam 2: Nkag Siab Li Cas Tus Tswj Xyuas Haujlwm Ua Haujlwm
- Kauj Ruam 3: Tsim ROS-MATLAB Interface
- Kauj Ruam 4: Tau txais IP Chaw Nyob
- Kauj Ruam 5: Tsim GUI rau Tus Tswj
- Kauj Ruam 6: Ua Haujlwm GUI Hloov Kho Khawm
- Kauj Ruam 7: Programming GUI Push Button
- Kauj Ruam 8: Teeb Kho Network Configuration ntawm ROS PC (Linux)
- Kauj Ruam 9: Khiav Tus Tswj
Video: Matlab-based ROS Robotic Controller: 9 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Txij li thaum kuv tseem yog menyuam yaus, Kuv ib txwm ua npau suav tias yog Iron Man thiab tseem ua li ntawd. Iron Man yog ib tus ntawm cov cim uas muaj peev xwm ua tau tiag tiag thiab yooj yim muab kuv lub siab los ua Iron Man nyob rau ib hnub txawm tias tib neeg luag kuv lossis hais tias nws ua tsis tau vim "nws tsuas yog ua tsis tau txog thaum ib tus neeg ua nws" -Arnold Schwarzenegger.
ROS yog ib txoj hauv kev tshiab uas tau siv los tsim cov txheej txheem neeg hlau yooj yim. Nws yog daim ntawv thov suav nrog: Cov Txheej Txheem Ua Haujlwm Tsis Siv Neeg, Kev Sib Txuas Lus, Caj Npab Caj Npab thiab Heavy Machinery ntawm kev lag luam.
Cov kws tshawb fawb thiab kws tshaj lij tau siv ROS los tsim cov qauv, thaum cov neeg muag khoom sib txawv siv nws los tsim lawv cov khoom. Siv MATLAB los tsim kev sib txuas sib txuas nrog ROS yog txoj hauv kev tshiab uas tuaj yeem pab cov kws tshawb fawb, kws tshaj lij thiab cov muag khoom hauv kev tsim cov kev daws teeb meem zoo dua.
Yog li cov lus qhia no yog hais txog yuav ua li cas ua Matlab-based ROS Robotic Controller, qhov no yuav yog ib qho ntawm ob peb qhov kev qhia ntawm qhov no tawm thiab nyob hauv ob peb ROS qhia. Lub hom phiaj ntawm txoj haujlwm no yog los tsim tus tswj hwm uas tuaj yeem tswj hwm ib qho ROS-neeg hlau txuas nrog koj lub network. Yog li cia peb pib!
video-editing qhab nia: Ammar Akher, ntawm [email protected]
Khoom siv
Cov hauv qab no xav tau rau txoj haujlwm:
(1) ROS PC/Neeg Hlau
(2) Router
(3) PC nrog MATLAB (version: 2014 lossis siab dua)
Kauj ruam 1: Tau Txhua Yam Teeb
Txog qhov kev qhia no, Kuv tab tom siv Ubuntu 16.04 rau kuv lub linux pc thiab ros-kinetic, yog li kom zam kev tsis meej pem Kuv pom zoo siv ros kinetic thiab ubuntu 16.04 txij li nws muaj kev txhawb nqa zoo tshaj plaws rau ros-kinetic. Yog xav paub ntxiv txog yuav ua li cas rau nruab ros kinetic mus rau https://wiki.ros.org/kinetic/Installation/Ubuntu. Txog MATLAB koj yuav yuav daim ntawv tso cai lossis rub tawm txoj hauv kev los ntawm no.
Kauj Ruam 2: Nkag Siab Li Cas Tus Tswj Xyuas Haujlwm Ua Haujlwm
Ib lub pc ua haujlwm tswj cov neeg hlau ntawm MATLAB. Tus tswj hwm siv tus IP chaw nyob thiab chaw nres nkoj ntawm ros pc/neeg hlau.
Cov ntsiab lus ros tau siv los sib txuas lus ntawm tus tswj hwm thiab ros pc/neeg hlau, uas tseem tau coj los ua tus tswj hwm. Tus qauv yuav tsum tsim kom muaj LAN (network hauv cheeb tsam) thiab yog dab tsi muab tus IP chaw nyob rau txhua lub cuab yeej txuas nrog nws lub network. Yog li ros pc/neeg hlau thiab lub pc khiav tus tswj yuav tsum ob leeg txuas nrog tib lub network (piv txwv li. Network ntawm modem). Yog li tam sim no koj paub "nws ua haujlwm li cas", cia peb mus rau "li cas nws tau tsim" …
Kauj Ruam 3: Tsim ROS-MATLAB Interface
ROS-MATLABInterface yog qhov muaj txiaj ntsig zoo rau cov kws tshawb fawb thiab cov tub ntxhais kawm rau kev tsim qauv lawv cov txheej txheem neeg hlau hauv MATLAB thiab sim nws ntawm ROS-tau tshaj cov neeg hlau. ib tus neeg siv ROS-siv neeg lossis hauv cov neeg simulators xws li Gazebo thiab V-REP.
Txhawm rau nruab cov cuab yeej siv tshuab cuab yeej cuab yeej rau ntawm koj MATLAB, yooj yim mus rau qhov Add-on option ntawm lub cuab yeej thiab tshawb rau lub cuab yeej neeg hlau nyob hauv tus neeg tshawb nrhiav ntxiv. Siv lub cuab yeej neeg hlau peb tuaj yeem tshaj tawm lossis sau npe rau ib lub ncauj lus, xws li ROS node, thiab peb tuaj yeem ua rau nws yog tus tswv ROS. MATLAB-ROS interface muaj feem ntau ntawm ROS kev ua haujlwm uas koj tuaj yeem xav tau rau koj cov haujlwm.
Kauj Ruam 4: Tau txais IP Chaw Nyob
Rau tus tswj kom ua haujlwm nws yog qhov tseem ceeb uas koj yuav tsum paub tus IP chaw nyob ntawm koj li ROS neeg hlau/pc thiab lub pc khiav tus tswj ntawm MATLAB.
Kom tau txais koj lub pc ip:
Hauv Windows:
Qhib cov lus txib tam sim thiab ntaus ipconfig hais kom ua thiab sau cia IPv4 chaw nyob
Rau Linux:
Ntaus ifconfig hais kom ua thiab sau cia qhov chaw nyob inet. Tam sim no koj muaj tus IP chaw, nws yog lub sijhawm los tsim GUI…
Kauj Ruam 5: Tsim GUI rau Tus Tswj
Txhawm rau tsim GUI, qhib MATLAB thiab ntaus ntawv qhia hauv qhov hais kom ua qhov rai. Qhov no yuav qhib daim ntawv qhia app txawm tias peb yuav tsim peb li GUI. Koj tseem tuaj yeem siv tus tsim app ntawm MATLAB los tsim koj li GUI.
Peb yuav tsim 9 lub nyees khawm tag nrho (raws li qhia hauv daim duab):
6 cov nyees khawm: Foward, Rov Qab, Sab laug, Txoj Cai, Txuas rau Neeg Hlau, Txuas Txuas
3 Kho kom raug cov nyees khawm: Ros pc ip, chaw nres nkoj thiab Npe Lub Npe.
Cov kho kom raug-cov nyees khawm yog cov nyees khawm uas yuav siv ROS pc tus ip, nws yog chaw nres nkoj thiab Lub Npe Lub Npe raws li kev nkag. Lub Npe Lub Npe yog dab tsi MATLAB tus tswj hwm thiab ROS neeg hlau/pc sib txuas lus los ntawm. Txhawm rau kho cov hlua ntawm lub pob uas tuaj yeem kho tau, nyem rau ntawm lub pob >> mus rau Tus Kws Tshuaj xyuas cov khoom >> Txoj hlua thiab kho cov ntawv ntawm lub pob.
Thaum koj GUI ua tiav, koj tuaj yeem tsim cov khawm. Nov yog qhov kev lom zem tiag tiag pib…
Kauj Ruam 6: Ua Haujlwm GUI Hloov Kho Khawm
GUI tau txais kev cawm raws li.fig cov ntaub ntawv tab sis cov cai/hu rov qab ua haujlwm tau txais kev cawmdim.m hom ntawv. > Saib callbacks >> callback. Qhov no yuav qhib cov ntaub ntawv.m rau koj GUI mus rau qhov twg lub khawm tshwj xeeb tau hais tseg.
Thawj qhov kev hu rov qab peb yuav mus rau tus lej yog rau ROS IP kho kom raug khawm. Hauv kev ua haujlwm edit1_Callback sau cov cai hauv qab no:
muaj nuj nqi edit1_Callback (hObject, eventdata, leeg)
ntiaj teb ros_master_ip
ros_master_ip = tau (hObject, 'Txoj hlua')
Ntawm no muaj nuj nqi tau txhais raws li edit1_Callback, uas yog hais txog thawj lub pob hloov tau. Thaum peb nkag mus rau tus IP chaw nyob los ntawm ROS network hauv khawm hloov kho no, nws yuav khaws IP-chaw nyob raws li txoj hlua hauv ntiaj teb sib txawv hu ua ros_master_ip.
Tom qab ntawd tsuas yog nyob hauv _OpeningFcn (hObject, eventdata, tuav, varargin) txhais cov hauv qab no (saib daim duab):
ntiaj teb ros_master_ip
ntiaj teb ros_master_port
ntiaj teb teleop_topic_name
ros_master_ip = '192.168.1.102';
ros_master_port = '11311';
teleop_topic_name = '/cmd_vel_mux/input/teleop';
Koj tsuas yog thoob ntiaj teb nyuaj-coded ros-pc ip (ros_master_ip), chaw nres nkoj (ros_master_port) thiab Teleop Topic lub npe. Qhov no ua li cas yog tias yog koj tso lub pob hloov kho tau khoob, cov txiaj ntsig tau teev tseg ua ntej yuav siv thaum koj txuas.
Kev hu rov qab tom ntej no peb yuav mus rau tus lej yog rau Chaw Hloov chaw khawm.
Hauv kev ua haujlwm edit2_Callback sau cov cai hauv qab no:
muaj nuj nqi edit2_Callback (hObject, eventdata, leeg)
ntiaj teb ros_master_port
ros_master_port = tau txais (hObject, 'String')
Ntawm no muaj nuj nqi tau txhais raws li edit2_Callback, uas yog hais txog khawm thib ob tuaj yeem kho tau. Thaum peb nkag mus rau ros pc/neeg hlau qhov chaw nres nkoj ntawm no los ntawm ROS network hauv khawm hloov kho no, nws yuav khaws qhov chaw nres nkoj raws li txoj hlua hauv ntiaj teb sib txawv hu ua ros_master_port.
Ib yam li qhov kev hu rov qab tom ntej no peb yuav mus rau tus lej yog rau Lub Npe Lub Npe hloov kho khawm.
Hauv qab kev ua haujlwm edit3_Callback sau cov cai hauv qab no:
muaj nuj nqi edit3_Callback (hObject, eventdata, leeg)
ntiaj teb teleop_topic_name
teleop_topic_name = tau txais (hObject, 'Txoj hlua')
Zoo ib yam li ros_master_port, qhov no ib yam nkaus yog khaws cia ua hlua hauv ntiaj teb sib txawv.
Tom ntej no peb yuav los saib ntawm kev hu rov qab rau lub laub khawm …
Kauj Ruam 7: Programming GUI Push Button
Cov nyees khawm uas peb tau tsim yav dhau los yog cov uas peb yuav siv los txav, txuas thiab tshem tawm cov neeg hlau los ntawm tus tswj. Lub laub khawm callbacks tau txhais raws li hauv qab no:
np. muaj nuj nqi pushbutton6_Callback (hObject, eventdata, leeg)
Nco tseg: nyob ntawm qhov kev txiav txim uas koj tau tsim koj lub laub khawm, lawv yuav suav tus lej raws. Yog li ntawd ua haujlwm pushbutton6 hauv kuv cov ntaub ntawv.m tuaj yeem yog rau Forward hos hauv koj cov ntaub ntawv.m nws tuaj yeem yog rau Rov qab yog li ua kom nco ntsoov. Txhawm rau paub qhov twg yog qhov ua tau zoo rau koj lub laub khawm, yooj yim-nias >> Saib callbacks >> callbacks thiab nws yuav qhib qhov ua haujlwm rau koj lub khawm tab sis rau qhov kev qhia no kuv xav tias nws zoo ib yam li kuv.
Txog rau Txuas rau tus neeg hlau khawm:
Hauv qab qhov kev ua haujlwm pushbutton6_Callback (hObject, eventdata, handle):
muaj nuj nqi pushbutton6_Callback (hObject, eventdata, tuav) thoob ntiaj teb ros_master_ip
ntiaj teb ros_master_port
ntiaj teb teleop_topic_name
ntiaj teb neeg hlau
ntiaj teb velmsg
ros_master_uri = strcat ('https://', ros_master_ip, ':', ros_master_port)
setenv ('ROS_MASTER_URI', ros_master_uri)
rosinit
neeg hlau = rospublisher (teleop_topic_name, 'geometry_msgs/Twist');
velmsg = rosmessage (neeg hlau);
Qhov kev hu rov qab no yuav teeb tsa ROS_MASTER_URI sib txawv los ntawm kev sib txuas ros_master_ip thiab chaw nres nkoj. Then rosinit hais kom ua yuav pib qhov kev sib txuas. Tom qab txuas, nws yuav tsim cov tshaj tawm geometry_msgs/Twist, uas yuav siv rau xa cov lus txib nrawm. Lub ntsiab lus lub npe yog lub npe uas peb muab rau hauv lub thawv kho kom raug. Thaum qhov kev sib txuas ua tiav, peb yuav tuaj yeem ua haujlwm Forward, Backward, Left, Right push buttons.
Ua ntej ntxiv kev hu rov qab mus rau Forward, Rov qab thawb buttoins, peb yuav tsum tau pib ua kom nrawm nrawm thiab nrawm nrawm.
Yog li hauv qab no _OpeningFcn (hObject, eventdata, tuav, varargin) txhais cov hauv qab no (saib daim duab):
ntiaj teb sab laug_spinVelocity ntiaj teb txoj cai_spinVelocity
ntiaj teb rau pem hauv ntejVelocity
ntiaj teb rov qab
left_spinVelocity = 2;
right_spinVelocity = -2;
forwardVelocity = 3;
backwardVelocity = -3;
Nco tseg: txhua qhov nrawm yog rad/s
Tam sim no hais tias cov kev hloov pauv thoob ntiaj teb tau hais tseg cia ua txoj haujlwm lub pob nyem.
Rau Forward pushbutton:
muaj nuj nqi pushbutton4_Callback (hObject, eventdata, leeg) ntiaj teb velmsg
ntiaj teb neeg hlau
ntiaj teb teleop_topic_name
ntiaj teb rau pem hauv ntejVelocity
velmsg. Angular. Z = 0;
velmsg. Linear. X = forwardVelocity;
xa (neeg hlau, velmsg);
latchpub = rospublisher (teleop_topic_name, 'IsLatching', muaj tseeb);
Zoo sib xws rau Backward pushbutton:
muaj nuj nqi pushbutton5_Callback (hObject, eventdata, leeg)
ntiaj teb velmsg
ntiaj teb neeg hlau
ntiaj teb rov qab
ntiaj teb teleop_topic_name
velmsg. Angular. Z = 0;
velmsg. Linear. X = rov qabVelocity;
xa (neeg hlau, velmsg);
latchpub = rospublisher (teleop_topic_name, 'IsLatching', muaj tseeb);
Zoo sib xws rau sab laug khawm: ua haujlwm pushbutton3_Callback (hObject, eventdata, tuav)
ntiaj teb velmsgglobal neeg ntiaj teb left_spinVelocity
ntiaj teb teleop_topic_name
velmsg. Angular. Z = left_spinVelocity;
velmsg. Linear. X = 0;
xa (neeg hlau, velmsg);
latchpub = rospublisher (teleop_topic_name, 'IsLatching', muaj tseeb);
Zoo sib xws rau Txoj Cai Pushbutton:
ntiaj teb velmsgglobal neeg hlau
ntiaj teb txoj cai_spinVelocity
ntiaj teb teleop_topic_name
velmsg. Angular. Z = right_spinVelocity;
velmsg. Linear. X = 0;
xa (neeg hlau, velmsg);
latchpub = rospublisher (teleop_topic_name, 'IsLatching', muaj tseeb);
Thaum tag nrho cov kev hu rov qab tau ntxiv thiab cov ntaub ntawv khaws tseg, peb tuaj yeem sim peb tus tswj hwm.
Kauj Ruam 8: Teeb Kho Network Configuration ntawm ROS PC (Linux)
Peb yuav sim ntsuas tus tswj ntawm ros pc (Linux), uas yuav xav tau teeb tsa lub network teeb tsa. Yog tias koj tseem tab tom tswj tus tswj ntawm lub tshuab linux, koj yuav tsum teeb tsa lub network teeb tsa ib yam nkaus.
Network Kho:
Qhib koj lub davhlau ya nyob twg qhov rai thiab ntaus gedit.bashrc
Thaum cov ntaub ntawv tau qhib ntxiv cov hauv qab no:
#Robot Tshuab Kho
export ROS_MASTER_URI = https:// localhost: 11311
#IP chaw nyob ntawm ROS tus tswv node
export ROS_HOSTNAME =
xa ROS_IP =
ncha "ROS_HOSTNAME:" $ ROS_HOSTNAME
ncha "ROS_IP:" $ ROS_IP
ncha "ROS_MASTER_URI:" $ ROS_MASTER_URI
Koj yuav tsum ua raws cov kauj ruam no txhua lub sijhawm vim kev ua haujlwm IP muaj zog.
Kauj Ruam 9: Khiav Tus Tswj
Peb yuav sim peb tus tswj hwm ntawm Turtle bot hauv Gazebo.
Txhawm rau teeb tsa Gazebo, thov xa mus rau
Txhawm rau nruab Turtle bot, thov mus saib
Qhib daim nplaub tshev uas koj tau khaws koj li.fig thiab.m cov ntaub ntawv ntawm MATLAB thiab nias Khiav (raws li qhia hauv daim duab). Qhov no yuav qhib lub maub los ntawm lub PC. Ua ntej nias txuas, xyuas kom tseeb tias koj tus vaub kib bot simulator ua haujlwm.
Txhawm rau sim koj TurtleBot simulation:
Qhib Terminal ntawm Ros pc thiab ntaus: $ roslaunch turtlebot_gazebo turtlebot_world.launch. Qhov no yuav qhib qhov kev sim ntawm Turtlebot ntawm lub PC ntawd. Lub ntsiab lus lub npe ntawm TurtleBot yog/cmd_vel_mux/input/teleop, uas peb twb tau muab rau hauv daim ntawv thov. Yog nyob rau hauv ros pc Ip chaw nyob, chaw nres nkoj thiab lub npe lub npe nyob rau hauv cov kho kom raug nyees khawm thiab nias lub. Txuas rau Robot khawm. Koj tus vaub kib bot yuav tsum pib txav mus thaum koj nias Forward, Backward thiab lwm yam.
Txhawm rau saib cov kab tawm thiab lub kaum ntse ntse:
Qhib lub davhlau ya nyob twg tshiab thiab ntaus cov lus txib: $ rostopic ncho/cmd_vel_mux/input/teleop
Thiab muaj koj muaj, koj tus kheej heev Matlab-based ROS Robotic Controller. Yog tias koj nyiam kuv cov lus qhia thov muab nws pov npav rau Thawj Thawj Tus Kws Sib Tw thiab sib qhia nrog ntau tus neeg kom ntau li ntau tau. Ua tsaug.
Pom zoo:
Hloov-Hloov Cov Khoom Ua Si: Cov Khoom Ua Si Cov Khoom Ua Si Ua Tau Zoo!: 7 Cov Kauj Ruam (nrog Duab)
Hloov-Hloov Cov Khoom Ua Si: Cov Khoom Siv Hluav Taws Xob Ua Tau Zoo!: Qho khoom ua si hloov pauv qhib txoj hauv kev tshiab thiab kev daws teeb meem kom tso cai rau menyuam yaus uas muaj lub cev muaj peev xwm txwv lossis kev xiam oos qhab kev loj hlob los cuam tshuam nrog cov khoom ua si ntawm nws tus kheej. Hauv ntau qhov xwm txheej, cov menyuam yaus uas xav tau cov khoom ua si hloov pauv tsis tuaj yeem nkag mus
Tuav Koj Tes Los Tswj OWI Robotic Arm Tsis Muaj Cov Txuas Txuas: 10 Cov Kauj Ruam (nrog Duab)
Yooj Yim Koj Tes Los Tswj OWI Neeg Hlau Caj Npab … Tsis Muaj Cov hlua txuas: Tus IDEA: Muaj tsawg kawg 4 lwm txoj haujlwm ntawm Instructables.com (raws li lub Tsib Hlis 13, 2015) ib puag ncig hloov kho lossis tswj OWI Robotic Arm. Tsis xav tsis thoob, txij li nws yog qhov khoom siv zoo tshaj plaws thiab pheej yig cov neeg hlau ua si nrog. Qhov project no zoo sib xws hauv s
Cov Khoom Siv Tsheb Robotic Sib Sau thiab Tswj los ntawm PS2 Wireless Chaw Taws Teeb: 6 Cov Kauj Ruam
Cov Khoom Siv Tsheb Robotic Sib Sau thiab Tswj los ntawm PS2 Wireless Chaw Taws Teeb: Txoj haujlwm no cuam tshuam nrog cov theem pib hauv Robotics ntiaj teb, koj yuav kawm sib sau ua ke 4WD Robotic tsheb khoom siv, tso kho vajtse rau nws thiab tswj nws nrog wireless PS2 chaw taws teeb
ROS MoveIt Robotic Arm: 4 Kauj Ruam
ROS MoveIt Robotic Arm: Qhov no yuav yog kab lus hais txog kev ua caj npab neeg hlau tswj nrog ROS (Robotic Operating System) thiab MoveIt. Yog tias koj nkag mus rau hauv neeg hlau ROS yog lub hauv paus zoo uas yuav pab koj tsim cov neeg hlau zoo dua sai dua. Nws tso cai rau koj rov ua haujlwm
DIY Arduino Robotic Arm, Kauj Ruam ntawm Kauj Ruam: 9 Kauj Ruam
DIY Arduino Robotic Arm, Kauj Ruam ntawm Kauj Ruam: Cov ntawv qhia no yog qhia koj yuav tsim lub Caj Npab Caj Npab ntawm koj tus kheej li cas