My New Self Driving (Toy) Car

My team put together a self driving car for my realtime operating systems class. Very interesting class overall. Definitely material I'll be using extensively in the future. After our final tests (races) were over, I duct taped an iPhone onto the front of ours.

In the video above, you might notice that our vehicle path is extremely oscillatory. Unfortunately, I didn't understand the cause of that oscillation until after the race was over. I initially thought it was due to inadequate range in our IR distance sensors, but it was actually due to instability in our controller. The whole design, implementation, and testing process was extremely ad hoc and empirical. We used a combination of PD controllers, one for each symmetric pair of IR sensors, to maintain center distance on the track. All the error terms merely summed together to produce one steering control value. This worked very well for the test track where we did all our tuning, but very poorly on the final race track which was significantly wider. Basically, our controller had a region of stability that depended on the track having the smaller width. Originally we wanted to use a different control strategy that rendered a map of the surrounding track and plotted a course through it, but 1) we didn't have time and 2) it's doubtful that would have been effective with the sensing resolution available. IR sensors are great, but they're not LIDAR.

The car:
Yes, the car has Texas long horns.

The code: