0
$\begingroup$

Rosanswers logo

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!


Originally posted by fabian on ROS Answers with karma: 46 on 2020-07-01

Post score: 0


Original comments

Comment by Geoff on 2020-07-01:
Start by looking at the list of topics printed by rostopic, and looking at each node with rosnode to see what topics they publish and subscribe to. It's likely that the turtlebot3 gazebo sim is using different topic names.

Comment by fabian on 2020-07-02:
Thank you, @Geoff for your comment - your help indeed allowed me to solve the problem! rostopic reveals that there is an active topic called cmd_vel When I bind red_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 and rostopic 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 via rostopic info TOPIC ?

Comment by Geoff on 2020-07-02:
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.

Comment by fabian on 2020-07-03:
Thanks @geoff for your comment. I wrote an answer based on your suggestions. I can't accept yet due to having too few points.

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Thanks to @geoff's suggestion, I managed to solve the problem. Instead of entering

 roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch 
 ./red_light_green_light.py cmd_vel:=cmd_vel_mux/input/teleop

I needed to publish to a different topic. The problem was solved by typing

roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch 
./red_light_green_light.py cmd_vel:=cmd_vel

Originally posted by fabian with karma: 46 on 2020-07-03

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by HM_1991 on 2022-02-26:
Worked a charm :) Thank you!

$\endgroup$
0
$\begingroup$

Rosanswers logo

Published version of ROS book stated to fire up the control node using:

./red_light_green_light.py cmd_vel:=cmd_vel_mux/input/teleop

Where cmd_vel_mux/input/teleop was to be the topic subscribed to the cmd_vel node. Later Gazebo versions after publication use a new cmd_vel topic needing to subscribe to the publisher also named cmd_vel.

Therefore:

roslaunch turtlebot3_gazebo turtlebot3_house.launch 

And in a new terminal:

./red_light_green_light.py cmd_vel:=cmd_vel

Originally posted by tommylwalker with karma: 56 on 2020-08-10

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by HM_1991 on 2022-02-26:
Amazing! Thank you for such a thorough explanation :D

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.