First Place Solution in 2021 Spring ROAR S1 Series Game
Written by James Cheney describing his experience and solution for their first place solution in Spring 2021 ROAR S1 Series Competition.
Team Name: Winning ROAR!!
Team Members: James Cheney and Chufan Guo with assistance from Michael Wu and Flaviano Christian Reyes
Table of Contents
Introduction
The evolution of the winning Roll ContRoll agent for entry into the Spring 2021 ROAR series S1
race began with a curiosity – what if I added a roll input to a PID autonomous vehicle controller
as a means of gauging maximum speed in a turn? To satisfy my curiosity, I replaced the entirety
of the longitudinal control (throttle control) of the PID agent with a simple algorithm: throttle
output = exp (-0.07 * |roll|). This output gives a result of one (maximum throttle) for zero roll
and exponentially reduces toward zero (no throttle) as body roll increases (The .07 number was
arrived at via a quick calculation of maximum observed body roll at the time and reducing to an
arbitrary low value of throttle).
This ultra simple throttle control immediately worked better! With a quick tuning of the roll
factor (performed by Flaviano Christian Reyes, a team member on another project who took an
interest in this experiment), this agent consistently outperformed the original agent as well as
the agent being developed by that team.
The insight gained from this experience was applied to preparing an agent for entry into the
ROAR series race, by the Winning ROAR!! Project Team 1 (of two teams), composed of James
Cheney and Chufan Guo. Michael Wu graciously offered support as a ROAR platform consultant,
and his help was instrumental in the success of our team.
Strategy, Design, and Implementation
During refinement of this agent, and experimentation with other steering control strategies, the
decision was taken to change the course for the race to the Berkeley map. This change defined
new challenges. While the old course was largely a giant figure-8 shape, the new course was
much more rectangular (see Figure 2 below). In the figure-8 shape, managing speed through
long sweeping turns was a key component for success, while in the more rectangular Berkeley
map, maximizing speed along long straightaways was key. Another significant change was the
waypoint map, which went from a fine-grained plot of 6512 points, to a coarse-grained plot
with only 263 points for a similar distance. This had the effect of the agent cutting corners too
sharply and colliding with the inner barrier in some turns (see Figure 1 below).
The coarseness of the waypoint map was addressed in two different ways. In the first approach,
the way points had curve fitting applied, creating 5000 points of a very smooth course (see
Figure 2 above), which was an improvement over the original method (in which the points were
generated by manually driving the course via keyboard input, which resulted in a rough plot).
This method worked great, but it was determined that an alternate set of waypoints was not
allowed. Therefore, we needed to either move the smooth waypoint generation into the live
agent or try an alternative approach. The second approach was to simply have a less responsive
steering control, which would not respond fast enough to cut through the corner between two
waypoints (see Figure 1 above), but would respond fast enough to navigate the curves overall.
The second approach worked satisfactorily. Future refinement may re-try the smooth curve
approach.
With this issue resolved, focus shifted to addressing the key component to a fast time on the
Berkeley track – maximizing speed in the long straightaways. First, in order to maximize speed in
the straightaways, we had to find a way to go as fast as possible, yet reduce speed in time to
make it safely through every turn. Second, we need to lose as little speed in turns as possible,
as it takes time to accelerate back to high speed, especially on the uphill portion of the course.
The strategy for going fast was to always apply maximum throttle on straight portions – starting
from the exit of a turn. To slow for turns, a look-ahead algorithm was applied to reduce throttle
(there were no brakes – only throttle variations) in time to safely yet minimally reduce speed for
curves. This look-ahead used the waypoints and trigonometry to calculate the heading change in the road ahead, by comparing the current vehicle heading (provided by CARLA) to the angle
of the line segment between two waypoints on the path ahead in reference to the
environment’s coordinate system (heading error). The throttle was reduced by a factor of the
magnitude of the heading error, and the distance ahead of the points used for comparison was
determined by a factor of speed. This resulted in reducing the speed further in advance when
going faster, and reducing it more aggressively in proportion to the increase in curvature. Once
this process was working, it was a matter of tuning these factors to achieve the best
performance on the track. This approach was the most critical aspect of strong and safe
performance in the race.
The second part of maximizing speed on the straightaways was maximizing speed through the
turns, so a higher speed could be reached sooner for the straight sections. This was
accomplished by using the Roll ContRoll to maximize speed through the corners by accelerating
to the limits of controlled trajectory with a little sliding in the turns.
The key issues addressed in the Roll ContRoll approach to fast lap times were discussed above.
The basis of overall steering control was adapted from the basic PID controller provided in the
ROAR platform. One issue encountered was that aggressive tuning (high gain) in this controller
resulted – as expected from control theory – in instability, resulting physically in the car
oscillating back and forth across the desired path of travel until it crashes, turns around, or a
new input reset the oscillation. The gain had to be tuned to keep the car tracking the desired
path satisfactorily, while not introducing detrimental oscillations.
Conclusion
In summary, the Roll ContRoller agent implemented a PID steering control (essentially PD as the
integral gain was not really needed), with throttle control being implemented by the Roll
ContRoller algorithm combined with a speed-sensitive look ahead for turns. Tuning of the PD
gains, look-ahead speed and throttle factors, and the roll factor were accomplished
experimentally to satisfactory performance in terms of speed and safety.
There is further room for improvement, refinement, and experimentation. Machine learning
could be applied to tune all of the control factors, which would optimize performance. There
are other steering control solutions that may offer superior integration possibilities – for
example a Stanley inspired control which implemented the look ahead calculation to widen the
vehicle’s approach to turns was attempted, but not adequately finalized to enter the
competition. If finalized, it is hoped this will allow even higher speed through corners,
significantly reducing lap times. The waypoint refinement could also be implemented in the
agent, and then this agent version tuned with machine learning to see if it resulted in
improvement. Finally, using an accelerometer to gauge cornering limits would likely prove
superior to using roll, especially for vehicles with aggressive suspension tuning (this race used a
passenger car tuning, that offered plenty of body roll for application in the Roll ContRoller
algorithm).