How to stop Turtle bot from circling around

In one of the exemples we needed to make the robot to move. After that i probabli does not terminate somthing and my robot is circeling since .

Please help ,i think he s getting dizzy!

To stop the robot from moving, you have to write (publish) to the /cmd_vel topic. The message used for that is Twist (type ‘rosmsg show geometry_msg/Twist’ in the shell). Make sure that the linear and rotational commands are all zero. Also, you can bring the robot to the initial position by resetting the simulation.

1 Like

Hi @rolandszeles6,
Welcome to the community …!! This problem itself is a very common one, make sure to send out a cmd_vel message with 0 linear and angular velocity before the ros node is shutdown to make sure the bot comes to rest.

You can implement the same using the shutdown hook (more info about them here )

Here is a small example on its implementation:

rospy.on_shutdown(shutdownhook)  # add this line to your main program 

def shutdownhook():
## define the above mentioned function and send the twist messages here
   cmd = Twist()
   cmd.linear.x = 0.0
   cmd.angular.z = 0.0
   self.publish_once_in_cmd_vel(cmd)

Happy Learning …!!

1 Like