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

Revision history [back]

Your calculation are correct but you should pay attention to update frequency: if it is too high respect to wheel velocities your calculated speeds will be unstable. Just and example: your robot is moving at 0.01 m/s. If you have 0.1 radius wheels and 360 ticks per round encoders ticks increase by 11 every second. If you update velocity at 20Hz means that sometime deltas will be zero, some time one, where your robot is moving at constant speed. Same happens when the thick from encoders are not synchronised.

To avoid this you should add an update system that wait for consistent data available.

For your information I did the same in different way. I'm using MD25 board that include close loop control of motors so I can be sure my speed input results in fixed speed. I use the input to MD25 to calculate speeds instead to calculate by real thicks.

Your calculation are correct but you should pay attention to update frequency: if it is too high respect to wheel velocities your calculated speeds will be unstable. Just and example: your robot is moving at 0.01 m/s. If you have 0.1 radius wheels and 360 ticks per round encoders ticks increase by 11 every second. If you update velocity at 20Hz means that sometime deltas will be zero, some time one, where your robot is moving at constant speed. Same happens when the thick from encoders are not synchronised.

To avoid this you should add an update system that wait for consistent data available.

For your information I did the same in different way. I'm using MD25 board that include close loop control of motors so I can be sure my speed input results in fixed speed. I use the input to MD25 to calculate speeds instead to calculate by real thicks.

UPDATE

Another way is to publish encoder ticks only if there is a change in the encoder position then deltas are never zero, right?

No, you will have same problem! The best you can do un order to be sure about results is to run your code and drive your robot at minimal speed. If detected speeds are constant all is fine. If output is not stable... you have to think about possible fixes.