Second Place Solution in 2022 Spring ROAR S1/S2 Series
Written by Cameron Shaw, Kaveer Gera, Dorian Kolis, and Phillip McClure, our ambassador and his team from Athenian High School, describing their solution for the Spring 2022 ROAR S1/S2 Series competition.
Table of Contents
Introduction
The 2022 spring season is the first to use the new Berkeley major map. This map presented us with a challenge since there was a high variance in the type of terrain present with many sharp turns and hilly sections of track. In previous seasons, Cameron Shaw, who is one of the authors, relied on a basic PID approach, but this would not work well for the new map. To solve this problem, we designed an agent that allowed for hardcoded regions where different target speeds could be set.
Strategy, Design, and Implementation
Originally, we were optimistic about making an agent that used some sort of machine learning, but this seemed too daunting for a brand-new map, so we chose a more simplistic approach that turned out to be quite effective.
The agent works by taking in a JSON file with a list of regions defined by min and max coordinates. The controller then determines which region it is in and adjust the max speed value of the PID controller at each step. This allowed for very straightforward optimization and enabled the car to go as fast as possible on straightaways and slow down in time for turns. The hills section has many turns, so it would be difficult to hardcode values for all these areas. Instead, we ran the agent at the same speed for the entire hills section and added regions for points where the car was more prone to collision.
Here is the code responsible for setting the target speed based on the location of the vehicle at every step:

In addition to the region-based approach, we also modified the standard PID controller to use braking, which allows the car to go at speeds >200mph for a longer period. After trial and error, we eventually decided on this formula for calculating the throttle/braking from the output of the PID:

Next Steps
We did not have enough time to record our own waypoints but plan on doing so in the future for at least the downtown area. We also want to devise another way of defining regions that would follow the track while still allowing for flexibility.
Conclusion
This season was quite challenging for us since we had never used this map before, and we faced several issues trying to get the agent to make a full lap. Now that we have a working solution to build off for next season, we can spend more time on optimization.