Carwin42: Evolution of Artificial Intelligence Controller and Aeromechanical Setup in Simulated Race Cars
Carwin42: Evolution of Artificial Intelligence Controller and Aeromechanical Setup in Simulated Race Cars
Carwin42: Evolution of Artificial Intelligence Controller and Aeromechanical Setup in Simulated Race Cars
1. Introduction
Race cars change almost each time they are used. Suspension, gears,
aerodynamics, are continuously played around with, in search of a track
dependant optimum that also varies with the drivers capabilities and
predilections. The present work describes some preliminary results obtained by
CARWIN42, a software developed by a team led by Dr. Pinto and based
1
(during the two years of its initial development phase) at the Industrial Design
and Management Department of University Federico II, Napoli. CARWIN42
includes an Eulerian simulator of racecar physics, an AI engine to drive the car
and an evolution engine which acts both on AI parameters and on the cars
aeromechanical setup in order to reduce laptimes. While some papers about
racecar setup optimization were published [7,8], to the Authors knowledge this
may be the first attempt to study its interactions with a driving AI.
2. Racecar physics
Racecar physics are dominated by extremely non-linear phenomena, and are
also supposed to operate usually in regions where nonlinearities are most
evident
2.1. Tyres
Tyres generate a force in the ground plane, the magnitude of which varies with
vertical load, slip angle (angular difference between the direction of tyre speed
and the tyres equatorial plane) and slip coefficient (measure of difference
between tyre peripheral speed and road speed) . Variation with these factors is
non linear; most notably, increasing the vertical load gives a less than linear
increment in forces. Strong negative correlation exists between longitudinal and
lateral component. A model to calculate tyre forces is Pacejkas Magic
Formula [2].
2.2. Aerodynamic setup
Racecars are usually designed to provide downforce, in order to augment the
vertical load on tyres, thus increasing the forces they are able to produce and
improving cornering, braking and low-speed acceleration. Front-rear downforce
distribution heavily influences the cars behavior, the more as speed increases.
Wings generate downforce at the price of an increment in aerodynamic drag. A
given wing will produce more downforce (at a diminishing rate) and drag ( at an
increasing rate) as its angle of attack is increased.
Modern racecars derive about 40% of their downforce from ground effect.
Ground effect is more efficient than wings; that is, a given quantity of
downforce will cost less in terms of drag. This downforce is obtained by
shaping the car bottom in such a way that the air under the car is accelerated,
therefore reducing its pressure. The magnitude of this force increases as
ground clearance decreases (a role is also played by the cars pitch angle). At a
critical distance from the ground, anyway, it will drop.
Static ride height selection should be such that ground clearance is minimized
yet the critical value is never reached despite suspension movements. The
application point of ground effect downforce is affected by the cars pitch angle
too. This has unpleasant consequences in some circumstances. Under braking,
infact, the cars nose gets nearer to the ground, while the rear lifts; this produces
a sudden advance of the center of pressure, and a tendency for the car to spin
[5].
2.3. Mechanical setup
Mechanical setup includes suspension tuning, front-rear brake force distribution
and gear ratios selection.
A critical factor in suspension tuning is roll stiffness distribution. When a car
negotiates a bend, it experiences an overturning moment that tends to load the
outside tyres more than the inside tyres. The front-rear distribution of this
moment is dependant on the roll stiffness of each end. Due to the nonlinear
relationship between vertical load and lateral force generated by tyres, the end
with greater roll stiffness will experience a greater decrease in adherence than
the other. This will influence the behaviour of the car, influencing it towards
oversteer, if rear end has less adherence, or understeer in the opposite case. A
similar pehenomenon, longitudinal load transfer, causes, with most suspension
geometries, the car to dive under braking and squat under acceleration.
A racecar suspension is designed to tackle two tasks: provide a reaction to road
irregularities that is small enough to minimize adherence loss caused by varying
loads, and provide a front-rear load transfer that will maximize cornering
capabilities. Springs also control ground clearance variations induced by load
transfer and downforce (see 2.4).
While several formulas exist to calculate an ideal gear ratios distribution for
production cars, nothing of the sort applies to racecars. This happens because
their more powerful engines easily cause low speed wheelspin , rendering too
short gears useless, and because the optimum balance between top speed and
acceleration varies with aerodynamic drag and also from a racetrack to another.
Harder braking will shift more load on the front wheels and require more
forward-biased brake distribution. Yet on twisty tracks it can be helpful to have
more braking on the rear to help the car turn in.
2.4. Aeromechanical interactions
In order to minimize height variations, ground effect cars require stiffer springs
than normal. Alas, these cause a sizeable reduction (10% and more) of the time
averaged adherence coefficient in a given condition.
3. Racecar driving
A race driver will always attempt to extract maximum forces from tyres,
balancing their lateral and longitudinal component. Steering is required to keep
the car as near as possible to optimal trajectory. An optimal trajectory for a
single corner is, in first approximation, an arc that starts on the track side
corresponding to the external of the corner, touches apex at mid corner and then
goes wide again at the corner exit. This path will have a radius much greater
than the corners, allowing the car to travel faster through it.
Figure 1. A racecars trajectory. The car enters from top-right , using all the tyres force to steer, and
progressively accelerates until exit, bottom left (image taken from [1])
Very often, anyway, optimal trajectories end up not being circular arcs traveled
at constant speed, but more complex curves the first part of which is traveled
under braking while in the last part the car is accelerated. Drivers tend to favor
understeering setups on faster tracks.
4. Software implementation
CARWIN42 has been developed in Fenix language (http://fenix.divsite.net).
Fenix is an open source freeware programming language with elements from C
and Pascal; it has very good and easy to use graphic libraries which were useful
to reduce development time, and outweighted the languages greatest
shortcoming i.e. the lack of a double precision data type.
5. Physical Models
CARWIN42 can employ three different physical models for vehicle dynamics,
of different accuracy and proportionally high computational effort. All models
share the same aerodynamics calculation module, which includes ground effect.
Single track model is based on the assumption that both wheels have the same
slip angle [3,6]. Tyre forces on the same axle are added together in axle
v2 k R v
d
Mk3 made the car quite good at preparing turns, and at negotiating chicanes,
but it was still sub-optimal in corner exit. Also, it allowed for soft braking in a
straight line, in most situations an anathema to racing .
The corner radius calculation system proved to give inconsistent readings,
causing sudden changes in car speed. Moreover, the system was incapable of
discerning between two corners having the same radius but different lengths,
and therefore different optimal trajectories.
Another shortcoming was inability to take into account the increasing adherence
caused by downforce as speed increases. The resulting driving was thus
overconservative at high speeds.
Figure 2. Sensors on AI Mk3. Sensor 1 determines distance to grass ahead of the car; sensors 3,4
determine distance a,b from the tracks sides; the circumference passing through sensors 1,2,3
provides an estimate R of corner radius.
diminishing function of laptime; cars that did not complete a lap get a fitness
proportional to the distance traveled. The slowest of the cars that completed a
lap will always have a fitness greater than the best one of non-finishers.
Figure 3. Learning to drive. At generation 0 cars cannot make it through the first corner. By
generation 8 most of the population is selecting a racing trajectory of sort (AI Mk4, 101 cars)
Figure 4. Circuits (same scale): High Speed oval, Low Speed Oval , MiniMonza
one individual able to complete a lap; the selection therefore initially rewarded
the individuals able to complete the most meters before leaving the track.
Once these were found, a decrease of laptimes with generations was observed
here too, yet with a less gradual decrease due to the higher chance for an
innovative individual to crash .
Setup Parameter
LSO
MM
20
% rear braking
29%
19%
44%
14
12
51
53
65
2.19
1.39
2.48
40
45
52
0.56
0.61
1.08
33
36
42
25
21
27
24
27
33
15
12
19
19
20
27
The faster the track, the higher gears and the smaller the selected wing angles.
The cars consistently showed much stiffer springs at the front than at the rear, as
expected to tackle ground effect. Evolved ride heights were higher at the front
than at the rear, allowing for higher downforce and lessening aerodynamic
instability phenomena.
It is also evident, though, that the AI controller behavior dictated some setup
choices not in line with what would have happened with a proper driver. While
it would have been expected to see an increase in rear wing angle versus front
wing angle on faster circuits, this did not happen. Actually, an oversteering
setup was developed on HSO to compensate for controller shortcomings (see
6). Also, front-rear braking distribution does not appear to follow a discernible
path.
8.3. Is it in the car or in the driver?
It was also attempted to find a measure to understand if decreasing laptimes
depended more on setup or AI evolution. This was done by applying a formula
that measured an average variation V of parameters from lap to lap:
1
NJ
NJ
Pi (G ) Pi (G 1)
i =1
Pi
Where N is the number of cars, Pi (G) is the i-th parameters value at lap G,
and Pi the difference between the allowed maximum and minimum of that
parameter.
Figure 6. Cumulated function of relative variations (compared to the lap before) of setup, AI and
laptime ( example taken from Low Speed Oval tests, AI Mk3)
It was found out, as shown in Fig.6, that a given decrease in laptime always
involved smaller relative variations of AI controller parameters than of setup
parameters. This was interpreted as a greater relative influence of AI controller
parameters.
9. Future work
Work is ongoing on a series of tests (enough to draw statistic inferences) using a
wider variety of racetracks and new Mk4 AI controller, the which is based on a
10
Finite State Machine and is completely different from (and far more efficient
than) its predecessors.
One of the main problems encountered by our AI controllers is robustness. Even
if good parameters are found, changing the starting position by just a few
meters would more often than not produce an accident. Therefore subsequent
work will be aimed at robustness, trying to evolve cars and AIs insensitive to
starting conditions. This might be achieved by putting more copies of the same
car in each generation, having each start in a slightly different position.
Competition between different AI concepts will also be tested.
Acknowledgments
The Authors would like to acknowledge the assistance provided by a number of
Professors from Federico II University, Naples, namely Prof. Antonio De Iorio
and Prof. Esamuele Santoro, Department of Industrial Design and Management
and Prof. Carlo Sansone, Department of Computer Sciences and Systems. A
thanks goes also to Prof. Carlo De Nicola, Department of Aeronautical Design,
for the continued encouragement. Our gratitude also goes to Eng. Ricardo
Divila (Nissan Motorsport) and Ben Michell for invaluable technical tips.
References
1.
2.
3.
4.
5.
6.
7.
8.
9.
11