Unicycle and Differential Drive Models

Since a wheeled robot cannot fly, we only care about these 3 states that define it’s pose:

x - position on the x-axis (ie in meters) y - position on the y-axis (ie in meters) φ - phi - angle of the unicycle counter clockwise from x-axis (ie in radians)

State and inputs for a unicycle model

For a unicycle model, there are 2 inputs that affect these 3 states of the robot:

v = forward velocity (ie meters per second) w = angular velocity (ie radians per second)

While wheeled robot can have any number of wheels and more complicated factors that can affect its pose, we conveniently use a unicycle model to describe the dynamics of most wheeled robot since it is easy and intuitive to understand. Specifically, we intuitively use v and w to describe how the unicycle will move.

This is all fine and dandy, but our ROSbots robot is a differential drive robot with 2 inputs for each of its two wheels:

v_r = clockwise angular velocity of right wheel (ie radians per second) v_l = counter-clockwise angular velocity of left wheel (ie radians per second)

Fortunately for us, we can convert unicycle inputs into differential drive inputs. Before we describe the equations to do the conversion, there are a couple of measurements we need to make with a straight edge.

Differential Drive Model

L = wheelbase (in meters per radian) R = wheel radius (in meters per radian)

Because R is a measurement of the radius of a wheel, it makes sense to think of R as meters per radian.

For L , it is not as intuitive. In the differential drive kinematics model, you can think of L as the radius of the circle drawn by one wheel spinning while holding the other wheel still. So L is also in the units of meters per radian where the radius is of that circle’s.

L is in meters per radian

We won’t go into excruciating details (since this is not a post on kinematics), but in summary, we can use the kinematics for a unicycle model and kinematics for a differential drive model to come up with the following equations to convert unicycle v and w inputs into v_r and v_l differential drive inputs for our ROSbots robot.

v_r = ((2 * v) + (w * L)) / (2 * R) v_l = ((2 * v) - (w * L)) / (2 * R)

The numerator for both equations are in meters per second. The denominator is in meters per radian. Both v_r and v_l result in radians per second, clock-wise and counter-clock-wise respectively— what we would expect.