Wednesday, 16 December 2009

Differential drive to forward/turnrate conversion

When controlling a differential drive robot like the epuck, I like to be able to control the speeds of the left and right wheel with my code. This allows you to easily program simple things like Braitenberg vehicles because you can directly interact with the wheel speeds.

HOWEVER. With Player/Stage if you're using a differential drive robot you can only interact with the motors using the robot's forward speed (metres/sec) and its turning rate (radians/sec). In order for your left and right wheel speed controller to properly interact with Player/Stage you need to convert between the two. This involves some pretty horrible maths and kinematics type stuff. For the lazy, here is the conversion between differential wheel speeds in metres/sec into forward speed and turn rates for Player/Stage. Instead of left and right speeds though we use inner and outer wheel speeds because the wheel on the inside must be slower than the outer one because it travels less far and this affects the maths.

newspeed = Inner_wheel_speed
newturnrate = (Outer_wheel_speed - Inner_wheel_speed)/distance_between_wheels
All measures are given in metres/sec.