Date post: | 13-Sep-2014 |
Category: |
Technology |
View: | 2,085 times |
Download: | 0 times |
Racing Controller Trained with Cultural Algorithms
WCCI2008Leonard Kinaird-Heether
Dr. Robert G. Reynolds AdvisorArtificial Intelligence Laboratory
Wayne State University, Detroit, Michigan 48202
Basics
• Controller written in Java using Eclipse.• Trained on Windows XP.• Designed to work with a plugin for the TORCS
racing simulator.
The Controller
• Controller receives data from the racing program and makes a decision using a system of rules.
• The data used includes:– The distance to the edge of the track in a 180° arc
oriented around the front of the car.– The RPM (Revolutions Per Minute) reading from
the car’s engine.– Whether or not the car is on the track.– Whether or not the car is traveling in the correct
direction on the track.
Turning
• The turning angle is determined by the distance to the edge of the track.
• The largest distance corresponds to the angle that the car will turn.
• This angle will then be normalized to fit within a range of -1 to 1, to correspond with the way the racing program deals with turning.
Speed• There is a set of rules used to determine how fast the car
is allowed to move in a certain area of the track.• This speed limit is determined by the turning angle.
– There are 10 rules for the set of turning angles:• 0°, -10° & 10°, -20° & 20°, -30° & 30°, -40° & 40°, -50° & 50°, -60° &
60°, -70° & 70°, -80° & 80°, -90° & 90°.• If the car is moving slower than the speed limit the
controller calls for acceleration• If the car is moving faster than the speed limit;
– If the current speed is <20 mph over the speed limit, the controller calls for no acceleration and no braking.
– If the current speed >20 mph over the speed limit, the controller calls for braking.
Shifting• The controller takes RPM measurements and determines whether
or not to upshift or downshift.– The controller waits 10 turns between shifts to eliminate repeated up
and down shifting due to the initial RPM drop that occurs right after upshifting.
– If the car is in neutral, something that occurs only at the start of the race, the controller shifts into first gear automatically.
– The car will upshift if the RPM measurement is above 7500 and the current gear is less than 6
– The car will downshift if the RPM measurement is below 4000 if the current gear is greater than 2.
– In the case where the car is in second gear, the controller will call for a downshift when the RPM measurement is below 3000, rather than 4000.
– Reverse gear is only used during error correction.
Error Correction
• There are three cases where car is considered in an error state.– The car has left the track.– The car is stuck.– The car is going the wrong way on the track.
• These are solved by a set of hard coded rules that were designed to resolve the problem.
• There is also a rule that keeps the car near the center of the track when going straight. This rule also helps smooth out the turning.
Cultural Algorithms
• The Cultural Algorithms Toolkit was used to refine the speed limit rules in the rule base.
• Each of the speed limit rules will decide the current maximum speed depending on what the current turning angle is.
• The original speed limits were set by hand, but proved to be unsuitable for use on the large variety of tracks in the TORCS system.
Training Setup
• The landscape has 10 dimensions, corresponding to the 10 speed limits.
• Each of the 10 dimensions had the boundaries of 0 and 300.
• The fitness of the track is determined by the distance that the car traveled in 10000 “turns” in the simulation. A longer distance corresponds to a higher fitness value.
Final Setup
• After each of tracks had a set of speed limits generated from the Cultural Algorithms Toolkit the results were hard coded into the controller.
• The initial distance to the edge of the track data was stored for multiple race starting conditions.– This data is used to determine what track is currently
being raced on, and thus, what set of speed limits to use.– In the event that the track could not be determined, 4 sets
of default speed limit values was created. • The controller starts using the fastest set of values.• If the car receives a certain amount of damage, the controller
switches to the next, slower, set.
Interesting notes
• Using different starting points on the tracks will affect the efficiency of a trained set of speed limit values.