ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

I think I see the problem. You're expecting the robot to rotate while you publish the cmd_vel messages and to stop rotating when you stop publishing these messages?

Depending on how your robot platform is interpreting the cmd_vel topic this is not what happens. Some robots will keep moving with a velocity given by the most recent cmd_vel message until they receive a different cmd_vel message. So to be safe you want to publish a cmd_vel message with a zero angular.z value to make the robot stop rotating. Then end of your callback should therefore be:

if yaw <= 90:
    cmd_vel.angular.z = 0.3
else:
    cmd_vel.angular.z = 0.0

pub.publish(cmd_vel)

Hope this helps.