This is an AI race car project I created during grad school showcasing fuzzy logic.
Built using the Unity game engine and scripted in C#, the AI race car agent drives along a randomly generated curving road. As a racing agent, the goal was to speed through the course without falling off the edges, getting stuck on the edge, or spinning out. Drive comfort and smoothness were not a goal, and consequently the car sometimes makes some really jerky or death-defying moves along the edge (sorry passengers!).
My implementation calculates the road’s center position at various lengths in front of the car (visible as yellow lines in the demo video), weights them appropriately, and creates a single target point to fuzz. This value and the car’s current speed are then “fuzzified” using membership functions I defined. Some of these resulting membership values are visible in the video demo above. These fuzzy memberships are then used to define rules for both the throttle and steering logic of the car.
My agent was ultimately able to speed through the course at an average of 51.9 km/hr over 5 minutes with no wipeouts. This beat the professor’s implementation, which went through the course at 43.6 km/hr.