How can I make the turtlebot3 walk forward through messages?
I appologize in advance for this simple question.
I would like to move the turtlebot3 ahead as described in the Programming Robots with Ros book. (The book teaches ROS programming under ros-indigo, whilst I have installed ros-noetic).
I created a package called wanderbot
which contains an executable called red_light_green_light.py to move the turtleboot ahead. The book describes the following commands to move the robot:
roslaunch turtlebot_gazebo turtlebot_world.launch
./red_light_green_light.py cmd_vel:=cmd_vel_mux/input/teleop
Because tutrtlebot_gazebo
does not seem to exist in noetic
, I replaced the commands above with
roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch
./red_light_green_light.py cmd_vel:=cmd_vel_mux/input/teleop
Unfortunately, the robot does not move an inch. What can I do to debug my code in this case?
There are three nodes active (gazebo_gui, red_light_green_light, gazebo) but the nodes are not connected. I presume the publisher in red_light_green_light
publishes messages but no node listens.
Could somebody kindly give me some hints what to do in these cases? I am grateful for any hints and suggestions!
Start by looking at the list of topics printed by
rostopic
, and looking at each node withrosnode
to see what topics they publish and subscribe to. It's likely that the turtlebot3 gazebo sim is using different topic names.Thank you, @Geoff for your comment - your help indeed allowed me to solve the problem!
rostopic
reveals that there is an active topic calledcmd_vel
When I bindred_light_green_light.py
to it, the robot indeed moves.I am wondering however how one is expected to figure that out usually?
rostopic
reveals existing topics androstopic info cmd_vel
shows very limited information about that topic. Is there a way for users to read more comprehensive documentation about existing topics than viarostopic info TOPIC
?Please post your solution as an answer and then mark it as accepted, for other people who might have the same problem in the future.
I'm not sure what you mean about "more comprehensive documentation about existing topics". In general, if two nodes are not communicating and they should be the first thing you check is what they are publishing and subscribed to. It's not something you should have to do when first learning, but because you are using code not in the book you are unfortunately beyond the bounds of the tutorial it provides.
Thanks @Geoff for your comment. I wrote an answer based on your suggestions. I can't accept yet due to having too few points.