• 大小: 0.46M
    文件类型: .pdf
    金币: 1
    下载: 0 次
    发布日期: 2021-03-27
  • 语言: 其他
  • 标签: 其他  

资源简介


在ros环境下,实现移动机器人pioneer 3的单个/多机器人控制。以及通过安卓手机控制机器人。
Fei liu - control pioneer 3 robots under ros liufei299@yahoo.com Introduction This document shows how control pIoneer robots (http://www.mobilerobots.com/researchrobots/p3at.aspx)underRos(Http://wiki.ros.org).All the work described in this document is done in MARHES Lab, department of electrical and Computer Engineering, University of New Mexico from September 2013 to August 2014. If you haveanyquestionaboutitorfindanyerrorpleasecontacemevialiufei299(@yahoo.com Fei liu - control pioneer 3 robots under ros liufei299@yahoo.com PART 1: Previous Preparation This part includes installing ROS and ROSARIa on local computer and the on-board computer on the robot. The operating systems of both computers are Ubuntu 12.04 LTS Step 1: Install ROs Followthestepsonhttp://wikiros.org/hydro/installation/ubUntutoinstallRos(versIon Groovy/Hydro)on your local computer and the on-board computer. And you are trong recommended through th whole Ros Tutorials (http://wiki.ros.org/ros/tutOriaLs)inordertolearnhowtherosworksalSopleasereferto Appendix c to look into the ros cheat sheet 1)It's suggested to install the same version of ros on both computers 2) The major ros versions released so far are http://wiki.ros.org/distributions 1> 22 July 2014- Indigo Igloo 2> 4 September 2013- Hydro Medusa 3> 31 December 2012-Groovy Galapagos 4> 23 April 2012- Fucrtc 5> 30 Aug 2011- Electric Emys 6>2 March 2011- Diamondback 7> 3 August 2010-C Turtle 8> 1 March 2010- Box Turtle 9> 22 January 2010-ROs 1.0 However, indigo only supports Saucy(ubuntu 13. 10) and Trusty(ubuntu 14.04)for debian packages(seehttp://wiki.ros.org/indigo/installation/ubuntU).ForUbuntu12.04,Hydroor Groovy are two suggestions for you 3) To get the version of ros that is installed on your computer, run S rosversion ros S rosversion rosling Step 2: Install ROSaRIA 1)Introduction of rosaria RosaRia(http://wiki.rossorg/rosarIa)providesarosinterfaceformostAdept Mobilerobots, Mobilerobots Inc, and Activ Media mobile robot bases including Pioneer 2, Pioneer 3 etc that are supported by Adept Mobilerobots open source Fei liu - control pioneer 3 robots under ros liufei299@yahoo.com Arialibraryhttp://robots.mobilerobots.com/wiki/aria)(arIa:Mobilerobots Advanced robot Interface for applications) Information from the robot base, and velocity and acceleration control, implemented via a RosAria node, which publishes topics providing data recieved from the robot's embedded controller by ARIA, and sets desired velocity, acceleration and other commands in aria when new commands are received from command topics 2)Steps for installing rosarIa Follow the link below to install rosaria http://wiki.ros.org/rosaria/TutorIals/How%20to%20uSe%020rosaria Collection of all the commands 1) Create a workspace. If a workspace exists already, skip to step 2) S. /opt/ros/hydro/setup. bash S mkdir-p/catkin ws/src S cd-/catkin ws/src S catkin init workspace S cd -/catkin S catkin make S cd-/catkin ws/src 2)install rosaria package: Sgitclonehttps:/github.com/amor-ros-pkg/rosaria.git S source /catkin ws/devel/setup. bash S echo"sourcc -catkin ws/devel/setup. bash">>-/.bashrc S source - /.bashrc vorosdep may install any additional ros packages not currently installed S rosdep update S rosdep install rosaria S cd/catkin ws/ catkin make t Notes 2) After installation, the Aria library will be found in /usr/locall 2)After installation, three important files should be found in/catkin ws/src/rosaria S cd -/catkin ws/src/rosaria CMakeLists. txt RosAria. cpp ackage. xml Fei liu - control pioneer 3 robots under ros liufei299@yahoo.com ParT 2: Connect robot via wireless network Step 1: Configuration Set the IP addresses for all computers and make sure that they are connected to the same wireless network. Table l shows an example of the configuration Table 1. Example of configuration of local and on-board computer Local Computer Robot(on-board computer) P1921680*(eg19216801)11921680*(e9191680160 OS Ubuntu 12.04 LTS Ubuntu 12.04 LTS ROS ROS Hydro/Groovy ROS Hydro/Groovy RosAria installed installed Step 2: Modify the host file Run the following command S sudo gedit /etc/hosts Then you will see the following lines in the file 127.0.0.10 calmest 127.0.1 1 your computer's hostname Add necessary information to the file that is finally like the following 1127.0.0.1| localhost 127.0.1.1 your computers hostname 192.168.0. ** your computers hostname 192.168.0.119 feiliu 192.168.0.113p3at-1 92.168.0.246p3at2 192168.0.191p3at3 192.168.0.254p3at4 92.168.0.160p3at-5 i #f The following lines are desirable for IPv6 capable hosts 1 ip6-localhost ip6-loopback fe00: 0 ip6-localnet i ff00: 0 ip6-mcastprefix ff02: 1 ip6-allnodes i ff02: 2 ip6-allrouters Fei liu - control pioneer 3 robots under ros liufei299@yahoo.com * Notes D)in the example above, the file should at least include four lines: 127.0.0.1 localhost 127.0.1 1 your computers hostname 192.168.0.*** your computers hostname 192.168.0.113p3at-1 where the first three lines are for local computer, the last line is for the robot that you ant to communicate with and control. "p3at-1" is the host name of one robot, and 192.168.0.1 13 is the ip address 2)when you encounter the problem that the local computer can not send the message to the robot, you should consider to modify this files for both the local computer and the onboard computer 3)to get the hostname for your computer, run S hostname 4)you need to modify the file for the robot too, for cxamplc 127.0.0.1 localhost 1270.1.1p3at-1 192.168.0.*p3at-1 192.168.0. 128 your local computers hostname Step 3: Connect the robot Open a terminal and use ssh to access the on-board computer S sSh-X-I root pioneer @192. 168.0.160 pioneer@192.168.0.160's password: marhes k Notes. 1) You can also run ssh pioneer@192 168.0 160 to access the robot 2) The parameters-X-I root will let you access the robot as the super user, where the most benefit is that after accessing the robot, you can use gedit to open and edit documents that are on the on-board computer 3)Please refer to Appendix b(Page 26)which introduces a simple way to run this command Fei liu - control pioneer 3 robots under ros liufei299@yahoo.com pat 3: Control the robot Step 1: Activate the robot Run 'RosAria?by following the steps shown in Table 2. By running RosAria, the onboard computer will establish the communication between the lower-level microcontroller(controlling the motors and other sensors)and itself, and the robot is ready to receive the command in order to run Table 2. Running rosaria Local Computer Robot(Onboard Computer) IP address eg.192.1680.19 eg.192.168.0.160 On local terminal On remote terminal: Commands ①$ roscoe (2)sexport Ros Master Uri=hTtp: /192.168.0.119: 11311 Ste 3 S source - /catkin ws/develsetup. bash 4Srosrun rosaria RosAria port: /devittySO 1)roscore is thc first step for running any codc undcr ros 2) If you run roscoe on remote terminal, then you dont need to set the master(export Ros maSter UrihTtp: //192.168.0.119: 11311) 3)If you get an error like"Could not open serial port/dev/tty",run the following 兴 Notes command on on-board computer sudo chmod a+rw /dcv/ttySO Then try to run S rosrun rosaria Ros Aria port: /dev/ttyS0 Or you need to access the robot as super user S sudo-s Tip: Files transfer between local and remote computer Sometimes you can edit the code/file on the local computer, then copy the file to the remote computer by using the command S scp file name. cpp pioneer@192.168.0.191: -/catkin ws/src/rosaria Where 1)file name. cpp the files to be sent 2) pioneer@192.168.0.191: referring the remote computer 3)-/catkin ws/src/rosaria: the location where to save the files Note if it is denied to transfer the file you may need to run the following command S sudo chown pioneer rosaria which is to make sure that the folder(e.g. rosaria is fully accessible to the user pIoneer' Fei liu - control pioneer 3 robots under ros liufei299@yahoo.com Step 2: Make the robot run Here is to illustrate how to control the robot move via keyboard 1. Highlights of codes 1) Highlights in RosAria. cpp https://github.com/amor-ros-pkg/rosaria/blob/master/rosaria.cpp class rosati aNode public: void cmdvel cb( const geometry msgs: TwistConstptr &)i protected: ros: Subscriber cmdvel sub; / subscribe to services cmdvel sub =n subscribe("/RosAria/cmd vel",10,(boost:: function <void(const geometry msgs: TwistConstPtr&)>)boost: bind ( &RosAriaNode: cmdvelcb, this,_1 ) ) void RosAriaNode: cmdvel cb( const geometry msgs: TwistConstptr &msg) 2) Highlights in rob key. cpp https:/github.com/drfciliu/pioncer3controlros/blob/master/robkey.cpp ros: Publisher vel _pub; int main(int argc, cha gv) el pub advertise<Twist>("/RosAria/cmd vel", 1; el_pub. publish(vel); 2.Run“ rosaria"”and“ rob kev" to control the robe 1)On remote terminal S rosrun rosaria RosAria port: = /dev/ttySo Fei liu - control pioneer 3 robots under ros liufei299@yahoo.com 2)On local terminal First you should download the file rob key. cpp (https://github.com/drfeiliu/pioneer3controlros/blob/master/robkey.cpp)andputitintothe package"/catkin wS /src/rosaria,, then compile it(see the note below Then run S rosrun rosaria rob key Now, you can use the keys‘↑↓‘←’and∴→’ to control the robot move orward”,” backward”, lun " le” and"right' respectively, and use‘ SPACE’ lo stop the robot *Note: To compile rob key. cpp, you first need to add the following four lines in CMakelists. txt add executable(rob key rob key. cpp) add dependencies(rob key rosaria_ genet dd dependencies(rob key rosaria gencpp) target link libraries(rob key Catkin LIBRaRIES $Boost LIBRARIES Aria pthread dl rt) then run S cd /catkin w S catkin make 10

资源截图

代码片段和文件信息

评论

共有 条评论