How to stop Turtle bot from circling around

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