Moving a Robot Part 3: Two wheels, moving differently

So in our previous episodes, we talked about some of the issues and ways we can make a robot move.

How does this even apply to a real robot?

In many small robot applications, we like to use robots with two wheels that are controlled separately. This is referred to as differential drive or differential steering.  Robots that behave like cars (i.e., four wheels, with two dedicated to steering), operate under the principles of Ackermann steering.  It’s a little more complex, which is why we, as I said, like to use robots with two wheels.

You can read all about the geometry behind differential drive, but what we’re interested in is just how to make our robot move.

So, from before, recall that we have two parameters: the linear velocity v and the angular velocity ω. Usually, for most wheeled robots, we can only move in discrete units, depending on a value that is set in some register. We will refer to this value as Cw.

(Note: You will likely have to figure out the value of Cw empirically. It will also likely be different among robots of the same model, due to motor nonlinearities, so, in this case, your mileage may truly vary.)

The basic differential drive equations can then be written as follows:

v = \frac{N_r+N_l}{2} \frac{1}{C_w}

\omega = \frac{N_r - N_l}{d} \frac{1}{C_w}

Where Nr is the number of units for the right wheel, Nl is the number of units for the left wheel, and d is the distance between the centers of each of the wheels.

The two quantities for the number of units are what we need to drive the robot. So, with some algebra that I’ve done for you, it’s easy enough to figure out how we need to set those values to get the robot to do what we want:

N_l = C_w \left(v - \frac{d \omega}{2} \right)

N_r = C_w \left(v + \frac{d \omega}{2} \right)

Plug those into your code, and you’ll be able to get your robot going at any speed you like. Just keep in mind that often you may be able to set these values as low as 1, but this will not cause actual movement in the robot. So be aware that the minimum speed you calculate will likely not be the minimum speed you can actually go.

And that’s it for this short little series on basic robot movement.  Hopefully you learned something interesting along the way!

This entry was posted in General and tagged , , . Bookmark the permalink.