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

Revision history [back]

As you've said you can get the actual simulated wheel speed from gazebo using the information provided by joint_states. So that is half the problem solved, the next bit is a little more difficult.

You need to work out the rate at which the robot is actually moving and work out the rate at which a 'non-slipping' wheel would have to turn to produce the same motion. The different between these two wheel rates will tell you the slippage.

When you know the actual linear x velocity and rotational z velocity from gazebo you can work out the 'non-slipping' wheel rates as below:

double vr; // x velocity in m/s
double va; // z anglular velocity in rads/s

// calculate the left and right wheel speeds in rads/s
wheel_speed_left = (vr - va * wheel_separation_ / 2.0) / wheel_radius;
wheel_speed_right = (vr + va * wheel_separation_ / 2.0) / wheel_radius;

Now you're left with the final task of getting the actual robot position from Gazebo. This previous question covers this quite well, although it's giving you the absolute location not the movement rate, so you'll have to differentiate this yourself to get the rover velocity.

To summarise measuring the actual wheel rate is fairly easy from gazebo, but to work out the slippage you need to know how fast the robot body is actually moving in gazebo. From this actual movement rate you can work out the wheel speed as if they weren't slipping at all. The difference between the two will give you the slippage.

Hope this helps.