To: "Rars mailing-list" 
Date: Fri, 25 Aug 2000 07:02:14 -0700
From: "Doug Eleveld"
Subject: How Felix cars work...

Hello Everyone,

This is a short description of how my Felix car works.  Imagine if there is a
big wooden pole on the front of a RARS car.  It sticks out maybe 30 feet out
the nose of the car.  Lets imaginge what happend when we start to drive with
this car while trying to keep the end of the pole in the center of the lane.  

When we approach a corner, the end of the pole will start to go around the
corner before the car actually does.  If we steer toward the end of the pole,
we will be properly cutting to the inside of the corner.  This works very
nicely if we make the length of the pole proportional to velocity of the car.
In this way the faster the car runs, the earlier it will start to cut into a
corner.   

Of course if we make the pole too long, the car will cut too far across the
corner and into the grass and get damage.  So there is some kind of optimal
length, that allows us to cut corners just enough.

But this does not help us properly setup for a corner.  We want to setup on the
outside of a corner when approaching it, and then cut across the middle to the
inside through the apex and then back around to the outside.  Although it is a
bit counter-intuitive, you should drive so that the pole stays on the outside
of the curve.  You would think that the pole should stay on the inside, but
just try to visualize it for a bit and you should see what I mean.   By putting
the end of the pole on the outside of the corner, we also need a longer pole
than if we just put the pole to the middle of the lane.  This has the further
advantage that the effective steering gain is lowered, which means less
steering which means more speed.

Now what if we follow both the inside and the outside of the track and keep
track of the lowest angles there.  The line to the inside of the track will
cross with the line to the outside of the track.  The line to the inside will
stop at the apex, and the line to the outside will go farther around the
corner.  The speed of the Felix car is then then determined by the difference
between the length of these two lines.  Essentailly we have plotted a straight
line in front of our car that goes through the apex, and ends on a track wall.
So we can imagine that when we reach the track wall we have to be stopped, and
then we can find what our speed should be by calculating braking distance to
the end of the line to the outside of the track.

The outside of a corner jumps around alot when in S curves, but the length of
the poles are long enough that it doesn't affect the steering too much.  I
tried to do some cosine interpolation of which side (left or right) of the
track is the outside for handling S curves better. 

Now if we also keep the info that we had to the pole to the center of the
track, we can use that for passing.  Whenever we are approaching someone and it
looks like there will be a collision, Felix reverts to driving to the center of
the lane, i.e. no longer to the outside.  This sometime works marvellously,
particularily on Michigan when passing slower cars, Felix will simply go
smoothly around them. Essentially it doesn't help much with high radius
corners, since everyone will be on the inside, but the possibility of the car
to change paths when avoiding cars helps passing a lot.

Now, there are some variables here, how far to look ahead, braking
coefficients, etc.  and these are all optimized for a very long random track
that I use for training.  The variables are optimized for the random track, but
the car won't crash or do anything wierd on most normal tracks, although there
seems to be some problems with the tight turns on fiorano.

Since only straight lines are used to look ahead, Felix does not look far
enough corners for it to be really optimal, but it does seem to be pretty good.
Particularily on hexagonal tracks is the conrnering less than optimal, because
the cortners are fast, but you can't see far around them using straight lines.

Felix does not use global coordinates and does not need complete track
information for reasonably good speed.  It looks ahead a maximum of 5 sections
ahead, but in most cases 3 is enough.  The last corner on Magnycrs is an
exception where you really need to look more sections ahead.

I hope this answers any questions anyone may have had about the Felix cars.  If
not, you can always mail me more specific quesions or there is always the
source...

Doug Eleveld