Racing Car AI Project

The application GUI

This was my final year project at Loughborough University, a project that pretty much completes the previous 2 years work on attempts to get a racing car to successfully navigate a given track without human assistance. I decided to work on getting reliable behaviour though the use of good image analysis to find the car, and it’s facing, then a set of simple rules for navigation. It was written in Java, since it was done in Java in the previous two years, used to make use of existing code.

Image Analysis

The track was assumed to be always in line with the camera horizontally, which allowed some simple algorithms to scan lines for unbroken non-track areas when the camera image was thresholded to find the track area. To find the car, a check for the total number of frame differenced pixels were done through the image. The front of the car was found by putting some red on it, and allowing a similar thresholding to find only red. To navigate around the track, waypoints were used, added by a few measurements of track areas and locations to put them in the same location each time.

The track area, found with waypoints
The car (red dot) it’s front (blue dot) and the next waypoint (pink dot)

Navigation Rules

After all the information was made available, the rules needed to successfully navigate between waypoints were kept simple since the car had a poor turning circle and didn’t have much in the way of advanced driving techniques to use. These were able to navigate from most “crash positions” (where the car cannot continue towards it’s next waypoint without turning), and was able to complete 10 laps of the track successfully. A sample of the points taken is below:

A single lap of navigation recorded by the cars navigation system


You can download my final report here:

The final code is available too, although it will need a certain web camera, and UserPort installed do much:

Finally, since the code is unlikely to run, there is a gallery of pictures (most which are in the report), and some videos available. These have some “commentary” but sometimes is of pretty poor quality and hard to hear. All of these are H264 MPEG-4 videos with AAC audio.

Edit September 2009: Ouch, I didn’t link the code properly on my site and never noticed, likely as not no one tried to download it anyway 🙂 Should be fixed now!

Leave a Reply

Your email address will not be published. Required fields are marked *

Website and journal of Andrew Armstrong