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:
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:
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!