First Place Solution in 2021 Fall ROAR S1 Series
Written by Ryan Chen describing his experience and solution for his first place solution in Fall 2021 ROAR S1 Series Competition.
Table of Contents
This project is part of a larger research project, Robot Open Autonomous Racing (ROAR), which has numerous AI race car competitions hosted by UC Berkeley. The S1/S2 competition that the project competed in uses the Carla simulator to create a virtual environment and competition map. The project primarily revolves around creating AI algorithms that autonomously control racing agents within the virtual environment. It is hoped that these AI algorithms and strategies can be translated into physical cars and tested in real world conditions, potentially competing in physical AI competitions in the future, such as the V1/V2 racing series.
Strategies, Development, and Implementation
The original strategy was similar to American aviation principles: An emphasis on speed in a straight line. The code was set up so that the Kp was at a high 200 kph and made turns as fast as possible to allow for the greatest amount of straight-line distance to build up speed. This fast turn time made the car “drift” in a sense, quickly turning nose on to the next corner, which also acted as a brake on top of reducing the throttle, allowing the car to accelerate almost constantly.
While this idea was sound in theory, I realized I had major issues with this setup. This was mostly confirmed while demonstrating my code with my original strategy during the ROAR summer camp, where Dr. Yang pointed out that there was a large amount of speed lost during the drifting maneuver. On further evaluation, it was found that acceleration of the car was not as fast as originally anticipated to cover for this speed loss. This acceleration did not allow the car to attain its top speed quickly after cornering, and in the time to regain the lost speed after cornering, a significant amount of time was lost. When attaining maximum speed of around 200 kph, it was found that the car would also sway, causing the PID steering to overcorrect, eventually swaying to a point where the car would crash. Even if it did not crash, the car would lose speed and have to travel a far greater distance with the swaying, both factors in increasing the lap times.
To correct these deficiencies in the current system, I opted to create smoother turns. I adjusted the PID values so that the steering bias was less sensitive and that the overall speed was slower to allow for less swaying of the car during straights and greater time for the car to turn, with other modifications to integrate it into the code. I ran through numerous trials trying to find the optimal cornering speeds to allow for maximum speed during the straights and greater preservation of speed while turning. In the range of around 110-130 kph I found that the car has become quite stable on the straights, so I no longer needed much braking via the drifting maneuver to corner, allowing me to further preserve speed through turns.
While working on this project I also encountered technical limitations and issues. I originally started working on the project using a laptop, but quickly found that the computer resources needed to run Carla and my AI agent within it were insufficient. I moved my setup to a motherboard PC, and while performance improved, the program sometimes became stuck or crashed. One day, after a series of trial runs to test new modifications, the PC motherboard died inexplicably, requiring the motherboard to be replaced. While this may have pushed me out of the competition, I decided to rebuild the PC to handle the workload required. When replacing the motherboard, I added CPU and GPU upgrades, as well as installed better NVMe disks for even more performance. After setting up the Carla software and my code, this newly rebuilt PC was able to run the system reliably, allowing me to make my final few tests and modifications before submitting my code for the test run. The test run proved to be very important as issues that went undetected on my client were discovered when testing on the server, allowing me to make the appropriate changes, such as the overcorrecting issue due to swaying crashing on the server but not on the client side.
My journey in working with ROAR showed that perseverance through technical issues and constant testing will allow one to find a solution to creating fast driven agents in the Carla environment, and I would like to thank Dr. Yang, Michael Liu, Huo Chao Kuan and the rest ROAR team for their important feedback and expertise during the summer camp and test runs. In retrospect, potentially creating an algorithm to find the optimal PID to balance top speed and efficient cornering would have saved a lot of time for further improvements such as creating a waypoint map to fit an ideal racing line or a better solution to solve swaying at high speeds.