Buscar este blog

viernes, 23 de julio de 2010

Run teleoperation node for pioneer

1. Teleopeate robot using the stageros node

$ roscd stage

$ ./bin/stageros
$ roscd teleop_base

$ ./teleop_base_keyboard base_controller/command:=cmd_vel


2. Check which topics are being published and subscribed to


$ rxgraph


We can see that stageros node subscribes to /cmd_vel topic of type geometry_msgs/Twist which is published by tbk_node.

3. Check the topics to which RosAria node subscribes

$ rosnode info RosAria

Subscriptions:
* /time [unknown type]

* /RosAria/cmd_vel [geometry_msgs/Twist]
* /clock [unknown type]

4. Edit teleop_base_keyboard.cpp from the teleop_base package.

$ roscd teleop_base

$ cd src
$ gedit teleop_base_keyboard.cpp

In line 82 we can see that a topic of type geometry_msgs/Twist is published by TBK_Node, therefore you need to change it to the topic to which RosAria subscribes (/RosAria/cmd_vel).

5. Copy the content of teleop_base_keyboard.cpp and create a new file in sscrovers_2dnav/src directory


$ roscd sscrovers_2dnav
$ cd src
$ gedit teleop_base_pioneer.cpp

And change line 82 as mentioned:

pub_ = n_.advertise("RosAria/cmd_vel",1); //TBK_Node publishes RosAria/cmd_vel topic and RosAria node subscribes to it


I also edited the max velocities in order to avoid accidents. In line 66:

double max_speed = 0.100; // m/second

Finally, I indicated in the menu (lines 135-146) which is the task of every key in accordance to the code written in lines 175-251:

puts("Reading from keyboard");
puts("-------------------------------------------------------------------------------");
puts("q/z : increase/decrease max angular and linear speeds by 10%");

puts("w/x : increase/decrease max linear speed by 10%");

puts("e/c : increase/decrease max angular speed by 10%"); puts("--------------------------------------------------------------------------------");
puts("Moving around:");

puts(" u=turn left and go forward i=go forward o=turn right and go forward");
puts(" j=turn left k=stop l=turn right");
puts(" m=turn left and go backwards ,=go backwards .=turn right and go backwards");
puts(" anything else : stop");
puts("--------------------------------------------------------------------------------");

6. Add the new file to CMakelists.txt


$ roscd sscrovers_2dnav

$ gedit CMakelists.txt

rosbuild_add_executable(teleop_base_pioneer src/teleop_base_pioneer.cpp)


7. Compile the package

$ rosmake sscrovers_2dnav


8. Run RosAria node

9. Run teleop_base_pioneer node


$ roscd sscrovers_2dnav
$ ./teleop_base_pioneer


10. The menu with indications should be displayed and you should be able to teleoperate you Pioneer.

No hay comentarios:

Publicar un comentario