Ask Your Question

Revision history [back]

The behaviour you're seeing is what we would expect. The timing of message delivery is non-deterministic and in fact message delivery at all is not guaranteed.

You will not be able to precisely control your robot by publishing Twist messages on the cmd_vel topic for a given amount of time, because the amount the robot will move by is determined by the time at which these messages are received which is non-deterministic. Also it was never inteded for the ROS message passing system to be used in this way.

If you want to precisely control the position of your robot in simulation as in the real world you will need some form of closed loop control. That is measuring the position of your robot and sending the appropriate movement commands until it is within a given tolerance of where you want it to be. You could do this by listening to the odom topic in simulation or using some type of sensor based localisation system in the real world robot.

Hope this makes sense.