Second Place Solution in 2021 Fall ROAR S1 Series
Written by Aaron Xie describing his experience and solution for his second place solution in Fall 2021 ROAR S1 Series Competition.
Table of Contents
Introduction
The ROAR S-series is a racing competition where you program a self-driving car agent on the ROAR Platform. Previously, I participated in the 2021 summer competition, but my time was much slower than I expected it to be. Apparently, I had made a mistake modifying a folder (ROAR_Sim) I was not supposed to, which caused the discrepancy.
It was time for redemption…
Strategy
During the ROAR Academy summer program, I was introduced to the AI concepts of machine learning and neural networks. Unfortunately, applying them into a functional self-driving car wasn’t that easy! As a result, I opted on optimizing the basic PID controller and the waypoints to be fast as possible.
With this strategy, I came up with a three main points:
- Full throttle the car until it has to slow down
- Brake as fast as possible upon reaching turns
- Change waypoints to follow the map’s racing line as close as possible
Design
1: Full Throttling
The PID controller contained a longitudinal controller, which basically controls the car’s acceleration. It sets the throttle to an ideal speed, and tries to maintain that speed. I found this longitudinal controller unnecessary and difficult to work with, so I replaced it with a simpler throttle controller. This controller always sets the throttle to max power. It also uses GSE (Gear Shifting Enhancement™) to further increase the car’s max speed.
2: Fast Braking
Full throttling would definitely get the car going. But what about sharp turns? In this case, I needed the car to know when it was approaching a sharp turn and put on its brakes accordingly.
To accomplish this, I used the waypoint coordinates as an indicator of the car’s relative location from the turn. I wrote a brake_waypoints JSON file that contained the exact string coordinates of the waypoint that I wanted the car to start braking at. Once the car reads the waypoint that is close to a turn, it is programmed to disengage the throttle (throttle = 0) and slam on the brakes (brake = 1).
Since this is a racing competition, I want the car to start accelerating again at full capacity once it has reached a safe speed to make the turn. Once the car reaches a certain speed, it is configured to stop braking and return to full throttle.
Focus 3: Optimized Waypoints
The original waypoint file contained waypoints scattered along the track. The file allowed the car to safely drive one lap, but the fastest speed would be achieved if the waypoints were set along a racing line. A “racing line” looks like this:
To make the car follow this racing line, I tried to set the waypoints to follow this line as close as possible. However, this was not very easy; it was difficult to set the waypoints at the perfect spots, and the car’s PID agent couldn’t perfectly follow the waypoints.
Testing
I had to go through many iterations testing my implementation’s braking system and waypoints. The main problems were either code mistakes that messed up the design or small issues with the brake timing and waypoint location. Although I didn’t formally count, fixing all these problems probably took over 100 test runs of the simulator!
For every run the car would spawn at the beginning, so the farther it progressed along the track the longer the test runs were. This would make some test runs very time-consuming, so I implemented a checkpoint spawn system where the car could spawn at a place farther along the track. Setting up the checkpoints was however tedious because you also had to update the waypoint file to correctly match that checkpoint’s location.
Conclusion
When I first tried out the ROAR simulator, the code appeared very overwhelming for me. There were all these different folders containing subfolders and python files and json files, and I couldn’t make sense of all of them. Although I felt like I needed to analyze and comprehend all of the platform’s components, I eventually learned that to be successful in the competition I only had to learn what I needed and modify what I could.
Although I was a little upset for not having come up with an AI-based solution, I am still quite content for having created a simple solution that made my car hit 231 miles per hour!
Side note: The solution I submitted in the Fall 2021 competition was exactly the same as the one I submitted in Summer 2021. The only difference was that it was reformatted to comply with the competition rules (no changing ROAR_Sim!). Next time, I plan to refine my waypoints with greater precision and optimize my PID values.