Robotics StackExchange | Archived questions

Turtlebot3 keeps rotating in Gazebo

I have spawned a turlebot3 in Gazebo environment using roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch. I have written a node that just keeps publishing an angular velocity to /cmd_vel. As soon as I start the node, the bot starts rotating in the Gazebo environment. However, when I exit the node from the terminal (by pressing Ctrl + C), the bot keeps rotating in the Gazebo environment. Why is this happening?

I even checked the following in the terminal - rostopic echo /cmd_vel. It didn't return anything. How is then the bot rotating?

Sometimes, I am facing the opposite thing i.e. I am publishing to /cmd_vel but the bot isn't rotating in the Gazebo world.

Asked by skpro19 on 2020-12-16 08:08:06 UTC

Comments

Answers

However, when I exit the node from the terminal (by pressing Ctrl + C), the bot keeps rotating in the Gazebo environment. Why is this happening?

I even checked the following in the terminal - rostopic echo /cmd_vel. It didn't return anything. How is then the bot rotating?

That happens because the Gazebo controller plugin (gazebo_ros_diff_drive) only updates the velocities when a new message is published on the cmd_vel topic. Unless you tell it to do something different, e.g., a zero velocities message on node shutdown, the robot will just continue to follow the last command.


I am publishing to /cmd_vel but the bot isn't rotating in the Gazebo world.

That one is unexpected and requires troubleshooting. Are there any errors/warnings? What does rosrun rqt_graph rqt_graph show when that happens?

Asked by tryan on 2020-12-16 12:45:16 UTC

Comments