Fuzzy Logic: Car Steering

June 6th, 2010


Fuzzy logic concerns the idea that human reason and language is based in ambiguity and uncertainty, demonstrating our subjective view of our environment. If we were to describe weather as “hot”, we would in fact be referring to a range of values of temperature based on our own comfort level, rather than a crisp and boolean statement.

Additionally, we use qualifiers such as “very”, “quite”, “slightly” and “too” to express the magnitudes of these values, with gradual transitions between such conditions. Traditional logic, and of course computers, by nature are based in precise and exact values. Fuzzy logic is an attempt to represent the approximate and overlapping nature of states in our world within a mathematical or computer based system. Rather than considering states as true or false, a degree of truth is considered for a variable given a particular input value, represented by graphs containing membership functions.

This application makes use of a fuzzy inference system to calculate steering values for a car, based on its distance and change in distance from a racing line. These techniques would allow an AI controlled car to be driven using only information which a real-life driver might have available.

The application was developed in Haskell as a method of further familiarising myself with the language, and because the problem seemed inherently suited to a functional programming approach. As ever, there are a number of changes I would make to the program based on what I have learned while writing it, however any criticism is greatly appreciated; I am still quite new to the language and paradigm.

Download the Executable
Download the Source Files
Car image from Guttorm Flatabø


Leave a Reply