Like many rovers, Square One relies on skid steering. I knew that a skid
steer vehicle can turn corners but I had no idea whether it would be
precise enough for autonomous driving. I did some experiments
to find out. The results were pleasantly surprising.
If you’re not sure what skid steering is then have a look at
this article for a recap.
TLDR: Just skip to the end of the article for my conclusions if
you’re in a hurry.
I’d been thinking of a corner as a section of a circle. If the rover is driving
down the middle of a 60 cm corridor then a left hand turn is just an anticlockwise
turn of radius 30 cm which goes on for 90 degrees.
To find out if this would be feasible for PiWars I needed
to answer the following questions:
can the rover drive round a corner smoothly?
would I be able to control the corner radius?
would I be able to stop at the correct angle?
If you think of the rover driving all the way round a perfect circle then
the inside wheels must follow a smaller circle than the outside wheels.
If the wheel speeds are proportional to the size of these circles
then the centre of the rover should follow the mid-point which is the yellow
vo - speed of outside wheels
vi - speed of inside wheels
r - radius of turn
w - width of rover (wheel separation)
v - speed of the rover
vo = v(r + w/2)
vi = v(r - w/2)
A Bit More Theory
In reality, the basic theory only applies for vehicles with true steering
under ideal circumstances. That’s definitely not true for skid steering.
I thought I’d find out if the academics have some better maths. Here’s what
the basic equations definitely don’t apply to skid steering
you need to account for the tyres skidding and slipping
skid steering involves a lot of skidding and slipping
we’ve no idea how much
if we just wave our arms a lot whilst muttering about torque and
instantaneous centres of rotation then maybe you’ll stop bugging us
meanwhile here’s some really complex maths that won’t help
… so that was dead end.
Square One can control the speed of each wheel independently using a PID controller.
I used the equations above to set the target speeds for each wheel and started
driving in circles.
Q1 - Driving Smoothly
It was immediately clear that the rover can drive in a nice smooth arc.
Q2 - Controlling the Radius
I now spent several hours driving the rover in circles and measuring the
actual radii that it followed. I checked out three factors that I thought
might influence the result:
desired radius (varied from 100 mm to 500 mm)
the level of grip (smooth wooden floor vs carpet)
the speed of the rover (varied from 200 mm/s to 1250 mm/s)
From previous measurements I knew that the wooden floor and the carpet
had coefficients of friction of around 0.7 and 1.4 respectively. The
PiWars challenges should be somewhere in that range.
I found that the actual radius of a turn is always much bigger than the
desired radius. The first big surprise is that the ratio between the two
doesn’t change much. On the wooden floor it’s around 1.8 times irrespective
of the desired radius.
Even more surprisingly, it’s not very different on carpet either. I could only
do limited runs on carpet because of problems with the motors hitting either
maximum or minimum power. The readings I did get suggest a ratio of about 1.7.
The effect of speed was also a little unexpected. Speed does affect the turning
circle. Faster runs create slightly tighter turns. The difference isn’t huge though.
The error varied between 1.9 and 1.6.
I decided that I can just divide the target radius by a factor of 1.75 and I’ll get
a turn that’s good enough.
Q3 - Stopping at the Correct Point
I have Square One set up to keep turning until the rover has travelled a certain
distance. It calculates the distance by averaging the distance that each wheel
has travelled. For this experiment, I compared the distance given by the rover
to the circumference of the actual circle that it turned. i.e. I’m was discounting
the difference between the desired and actual turn radius.
As you can see from this graph, the estimated distance varies by about +-10% of
the expected distance. Once again, the errors are slightly smaller on carpet but
are otherwise very similar.
In most of my tests, the rover started out running wide before settling down
to a steady state. This leaves room to improve my control code which may modify
the results a little.
I can log the amount of throttle applied to each wheel. It’s clear that
the amount of power fed to the different wheels varies considerably. In a tight
turn on a high grip surface, the rear outside wheel will reach full power.
Meanwhile, the inside wheels will be braking. In some tests the turn radius
was worse than expected because an individual wheel either couldn’t go any
faster or couldn’t go any slower.
If the rover can control the speed and power of each wheel independently
then skid steering works very well. This assumes that the rover is driven
on a smooth consistent surface such as a road or floor.
the rover turns in nice smooth arcs
the radius of the turn is about twice as large as expected
speed has a larger effect on the actual radius than anything else
the level of grip doesn’t matter much
the average distance travelled by the four wheels is a very close to the
distance travelled by the rover. i.e. odometry works quite well
tight turns require very high power levels from the outside rear wheel