# Formula for differential wheels translation/rotation

• Han Fastolfe
The basic formula is:outer angular velocity = inner angular velocity * (outer radius + wheel distance / 2)outer radius = inner radiuswheel distance = radius + (wheel distance / 2)distance traveled = (outer radius - inner radius) * (angle between outer and inner radius)angle between outer and inner radius = beta * (angle between base and side)new location = vector position + (gamma * angle between vector position and side)f

#### Han Fastolfe

Hi,

I'm building a simple 2D simulator for mobile robots, and I'd like to be able to determine the translation and rotation of a 2-wheeled simulated robot based on simple kinematics (no forces, friction etc). So, given these:

- angular velocity of each wheel (rad/s)
- distance between the wheels (m)

I'd like to have a formula / method for determining the robot's translation in the x,y plane and its rotation, given a certain timestep size (e.g., given the above three variables, how much will the robot translate and rotate in 64ms). I know that when e.g. the left wheel moves faster than the right, the robot will start to turn to the right, but I can't figure out / find how.

Thanks in advance for the help!

This is fairly easy. If the wheels run with constant speed the 2 wheeled robot will obviously run in circles.

You can make a drawing, to figure out what the radius is, the basic formula that will result should be:

$$\frac{\text{outer angular velocity}}{\text{inner angular velocity}}= \frac{\text{outer radius}}{\text{inner radius}}=\frac{\text{radius} + \text{wheel distance}/2}{\text{radius} - \text{wheel distance}/2}$$

The rest is high school trigonometry.

Thanks for the reply. The speed of the wheels isn't constant, but it is for very small timesteps. So in each timestep the robot controller sets its wheel speed, and I re-compute the new location and rotation angle.

I hadn't made the connection that outer v / inner v = outer r / inner r. So just to be sure that I've got the rest right (high school is a long time ago, but I think this should be correct. There's a diagram here to make it more understandable http://picasaweb.google.co.uk/lh/photo/yyJHKLykyuvlP8MAqKkZgQ?authkey=Gv1sRgCIjKg7CO97_9WA&feat=directlink" [Broken]):

Once I know the radius I know the outer and inner radius. From the angular velocity and wheel radius I can compute the distance traveled along the circle each describes. Then the rotation angle alpha the robot will go through in that timestep is

alpha = d / r, where d is distance traveled and r the radius.

So then I have the rotation. For translation I have a triangle formed by a base of length l, which is the distance between the bot's current and new location. Triangle has sides of length r, the top is at the centre of the circle that the bot is describing. The angle between the two sides is alpha. Hence the other two angles (between base and side) are:

beta = (pi - alpha) / 2.

From that it follows that

l = 2*r*cos(beta).

Now, to get the new location, I construct a vector of length l starting at the current location in the direction of the current bearing. I then need to rotate that vector through an angle such that the vector points to the robot's new location. This angle is

gamma = 1/2*pi - beta

The new location is then the point the vector points to.

Would that be correct? Also if anyone has a quicker/more efficient way of doing this, then please do tell since the program needs to do this calculation every timestep, so the quicker the better.

Thanks!

Last edited by a moderator: