Ask Your Question
0

How can I make the turtlebot3 walk forward through messages?

asked 2020-07-01 13:12:36 -0500

fabian gravatar image

updated 2020-07-03 01:30:27 -0500

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!

edit retag flag offensive close merge delete

Comments

1

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.

Geoff gravatar image Geoff  ( 2020-07-01 19:55:43 -0500 )edit

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 ?

fabian gravatar image fabian  ( 2020-07-02 10:54:38 -0500 )edit
1

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.

Geoff gravatar image Geoff  ( 2020-07-02 19:18:25 -0500 )edit

Thanks @Geoff for your comment. I wrote an answer based on your suggestions. I can't accept yet due to having too few points.

fabian gravatar image fabian  ( 2020-07-03 01:32:11 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2020-07-03 01:29:35 -0500

fabian gravatar image

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
edit flag offensive delete link more
0

answered 2020-08-10 16:05:50 -0500

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-07-01 13:12:36 -0500

Seen: 37 times

Last updated: Jul 03