Real-Time Operating System Race Car



This was the final project for EE380L-12 Real-Time Embedded Systems Lab (Graduate Class). We design and coded a real-time operating system in C for the TM4C microcontroller and developed code on top of it to create an autonomous race car.



We coded the RTOS from scratch including all contact switches, semaphores, and all other OS functions. The code emulates multiple threads running on a single core. The OS was tested thoroughly by writing the car logic on top of it as an application layer. Two microcontrollers were used for data gathering/algorithmic control and motor control which were connected via a CAN bus.

We are using five lidar sensors positioned around the front half the vehicle in an arc. The sensors run in continuous mode and are each sampled at a rate of 20ms. Their readings are fed into the control algorithms which then pipe commands to the motor board.

For controls, we have five lidar sensors that are being sampled continuously at 20ms. These sensor readings are filtered, converted to human-readable values(like cm), and then piped to the control algorithm. The control algorithm then sends a CAN command to the motor board that contains the servo angle and two motor speeds and directions. The motors then parse out all of those values and set up the PWM registers to meet the desired values. If a bump switch is hit, however, an edge-triggered interrupt is called that sends a special command to the motor to have it run a predefined routine in case a collision happens to get it back on track.

We have implemented multiple control algorithms into our car, and the car switches between each algorithm depending on the current situation it thinks it is in depending on the sensor readings. The first algorithm is a PID controller that tries to keep the car in the middle of the track by minimizing the difference in Lidar readings on the side. This algorithm is great for straightaways but not great for turns. If we detect a turn coming up we use Fuzzy Logic to line the car up with whichever front Lidar is projecting the farthest beam. One lined up we go back to the PID algorithm. If a problem has occurred and our car collides with the wall or gets too close we then switch over to some predefined routines that hopefully will line us up with the track and then we can switch over to whichever algorithm, PID or Fuzzy, is needed.


Demo of Race Car


Meet the Team


Keeshan Patel

Electrical/Computer Engineering Student


Shawn Victor

Electrical/Computer Engineering Student

Screen Shot 2017-04-14 at 7.46.42 PM.png

Rita Kambil

Electrical/Computer Engineering Student


Corey Hulse

Electrical/Computer Engineering Student


Shivani Gupta

Biomedical Engineering Student