• Skip to main content
  • Skip to primary navigation
  • Skip to primary sidebar
Header Search Widget
Robot Open Autonomous Racing (ROAR™)
  • ROAR Home
  • Programs
    • AI Racing Tech
    • ROAR GO
    • ROAR Academy
    • Ambassadors Program
  • News
  • Simulation Racing
    • Maps
    • Past Results
    • Blog
  • Support Us
  • Contact

Measuring the Margin: A Test Harness, Crash Maps and 83 Experiments on the ROAR Monza Controller

Second Place Solution in the Summer 2026 Simulation Racing Series

Written by Shaan Duggal, from Orange County School of the Arts for Team “Monza Masters”

Final result: 319.85 s, 2nd of 22, Monza v1.1
Code: https://github.com/Shaan-Duggal/ROAR_2026_Summer_Competition

Table of Contents

Abstract

My entry finished three laps of the Berkeley Monza map in 319.85 s. That was 0.20 s behind first place and 0.30 s ahead of third. I started from the Spring 2026 winning controller (320.40 s) and improved it by 0.55 s with changes to four tuning constants. I also added a ten-line fix so that a major crash no longer ends in a did-not-finish (DNF). With the fix in, all 94 of my test runs finished.

Most of my work this season actually went into building tools to help me decide what to try next. I wrote an experiment harness that saves a folder of data for every simulator run, and I logged 83 experiments over about 670 runs. From that data, I built four maps of the track:

  • an interactive waypoint bench;
  • a crash map of 148 first contacts;
  • a room map from 504 completed runs and a LIDAR scan of the barriers;
  • a clearance map of how close the car’s body gets to the wall over the whole lap.

The maps showed me where the car was close to the wall and where there was road nobody was using. They also showed why most of that extra road could not be turned into a faster lap.

In this post, I go through what I tried, how the harness works, what the maps showed, and how I picked the racing line I submitted.

Introduction

ROAR’s simulation series races a CARLA 0.9.12 car three laps around Monza. Over six seasons, the winning time has dropped from 327.35 s to 320.4 s, but by less each season. This season the top five were within 0.6 s of each other. When the gaps are that small, the hard part is not picking an algorithm. It is figuring out whether a change actually helped or you just got a lucky run. Most of what I built was for that second problem.

Facts about the setup

  • The clock counts ticks. Your score is ticks × 0.05 s, so how long your code takes to run does not matter. Every score is a multiple of 0.05 s; 319.85 s is exactly 6397 ticks.
  • target_gear does nothing. The car spawns with auto_gear=True.
  • A major crash resets your progress but not the clock. respawn() puts the car back at the start line, wipes all three laps of progress, and keeps the clock running.

Recommendations

If you are racing next season, these are the things I would do first (see 8 for a longer list).

    1. Fix the respawn bug before anything else. After a crash, the car loses the racing line and drives around until the race times out. The fix is about ten lines. With the viewer on, about 1 run in 5 ended up in a crash, so this is worth more than any lap-time change.
    2. Restart CARLA before every run, and compare back-to-back runs. In my experience, the simulator gets slower and less reliable the longer it runs. If you test idea A in the morning and idea B in the afternoon, this may skew the measurements.
    3. Test with the viewer on. That is how the grader runs it, and the car crashes more often with the viewer on than off.
    4. Know which file the car actually steers by. Editing waypointsPrimary.npz barely moves the car. The steering follows WaypointLine.line_locations.
    5. Measure the walls yourself. The real track is narrower than the 12 m the map says. One lap with LIDAR fixes that.
    6. Check every line change over the whole lap. Changing the line in one corner can make the car crash a kilometer later.

The testing harness

My first tuning tests gave me two wrong answers in one day, and both times the problem was how I was testing, not the car. I built this testing harness so I could trust my results.

Every run gets its own folder

Every timed run goes through one command:

python -m tools.experiments.run –config config\experiments\<name>.yaml

That command creates a run folder with:

  • the git commit, and whether there were uncommitted changes;
  • hashes of the map and waypoint files;
  • a snapshot of the machine;
  • summary.json;
  • events.jsonl, which logs crashes, respawns, and lap crossings;
  • ticks.csv, with about 70 columns for every tick: position, orientation, speed, the controls the code asked for and what the car actually got, lap and section.

All the charts and figures in this post come from these folders.

Each run uses one of three modes:

  1. fail_fast stops at the first major crash. I used it for quick screening.
  2. diagnostic is for measuring things.
  3. official runs exactly like the grader.

Four ways the simulator can fail

Canary runs and documenting predictions

Every screening batch starts and ends with a canary run, which is the submitted setup running unchanged. Once the machine started acting up, I also put a canary between every pair of candidates. If any canary is off by even one tick, the whole batch is thrown out. The tool then hides every result since the last good canary, so I cannot look at results from a bad batch.

This threw out several batches. Each time, when I reran them properly, the results told a different story than the thrown-out numbers would have.

Before each experiment run, I write down in the log an ID, a hypothesis that could be proven wrong, a rule for when to stop, and the result I expect. This helped more than I thought it would:

  • One result came in at p = 0.077, which missed the cutoff I had set beforehand, so I logged it as “suggestive” instead of using it.
  • One of my stop rules went against a conclusion I had written down four hours earlier, so I took the conclusion back.
  • For the steering change I ended up submitting, I wrote down the predicted time before running it: “320.20 s to ~319.85 s”. The official runs came back at 319.85 s.

The last check: running the real thing

Even if a setup wins in my harness, it is still just a set of overrides on my development code. The last check is different. It packages the submission exactly the way I would submit it, copies it to a clean folder outside my repo, and runs the unmodified official runner on it.

This check was worth it. On one version of the code, it found that 1 run in 5 used up the whole race timeout, which my harness had never shown.

Configurations I tried

Section 3 braking: 320.40 → 320.20 s

My first sweep tried every tuning constant in the controller I started from. Almost every one either did nothing or caused a crash:

  • per-section friction crashed in sections 1, 2, 4, and 6 and changed nothing at all in 0, 3 and 8;
  • adding 3 % to the overall braking force crashed;
  • the 305 km/h speed cap never kicks in, because the car’s top speed is 257 km/h;
  • making the lookahead longer could only lower the target speed, because the code picks the lowest speed out of all the points it looks at.

Section 3 was different. There, the brake-delay term usually makes the braking distance negative, so the corner speed target sets the speed directly. Two constants affect it, and they interact instead of just adding up:

I would not have found that pair by tuning each constant on its own. I only found it by trying them together.

Steering in sections 4 and 9: 320.20 → 319.85 s

The steering constants were not set up to be tuned in the code I started with, so first I changed that. A test checks that, with the default values, the code behaves exactly the same as before.

Raising steer_cap_s4 from 1.45 to 1.6 and steer_floor_s9_early from 1.5 to 1.7 saved 7 ticks: 6397 ticks on 10 out of 10 clean official runs, with no variation at all. It was also the first change that made the car both faster and safer. Before I ran it, the clearance map (see 4.4) predicted it would open a 2.5 cm gap at a corner where the car had been scraping the wall. That is the biggest single improvement in this code’s history.

Trading grip for room with section_mu[1]: tested, not submitted

Once crashes became the main problem, I tried giving up some grip to get more room from the wall. Lowering section 1’s friction coefficient opened up more room in the section-1 squeeze, and the lower I went, the more room there was. The sweet spot was 2.80: 5 ticks slower for 0.19 m more room, which is 4.5 times as much extra room as 2.85 gave for the same cost.

It worked the same way in the official runner, but I still did not submit it. When I compared clearance over the whole lap, the tightest spot was somewhere else, at s ≈ 3066 m, and this change did not help there.

Maps: finding the tight spots

A tick count tells you whether a run was fast or crashed. However, it does not tell you where it crashed. I built four maps to answer that.

The waypoint bench

A tick count tells you whether a run was fast or crashed. However, it does not tell you where it crashed. I built four maps to answer that.

Figure 1. The waypoint bench. All 2661 racing-line waypoints drawn over the LIDAR barrier and colored by speed, from lap 2 of one logged run. The strip along the bottom is the speed trace, with the slowdown zone shaded.

The bench is an interactive map of the racing line. When you click a waypoint, it shows:

  • its index, in both of the ways it gets numbered (see below);
  • its station (distance along the lap);
  • the corner radius there;
  • speed, lateral g, throttle and brake at that point;
  • how far it is from each wall, measured with LIDAR.

You can color the line by speed, corner radius, lateral g, room to the walls, or section. You can also drag a waypoint sideways, with the change blended into its neighbors, and export the result as a script that rebuilds the file.

One thing to know if you read collision logs: the solution skips the first 35 waypoints, so a crash logged at “wp N” is actually index N + 35 in the file. The bench shows both numbers next to each other.

The bench made the big picture easy to see:

  • The big slowdown, s ≈ 3824–4180 m, where the car brakes from 256 down to 155 km/h.
  • The most time I estimated could be gained, s ≈ 3800–4500 m, about 0.95 s.
  • The tightest corner, R ≈ 21 m at s ≈ 5555 m, taken at 89 km/h.
  • Two gaps in the barrier, at s ≈ 4425 m and s ≈ 5020 m, where the right wall moves out past 12 m. They are the two deep spikes in Figure 3. I did not send the line through either one.

The bench also taught me the most expensive lesson of the whole line project, which I explain in 5.1: dragging a waypoint here hardly moves the car.

The crash map

Figure 2. Where each of 148 crashed runs first hit the barrier. Each bubble is a cluster, sized by how many crashes it has. S0–S9 are the controller's own section boundaries. On the right: the five worst clusters, and every crash grouped by station.

This map plots the first major hit from every crashed run. The 148 runs include some screening tests that were aggressive on purpose, so the numbers show where the track punishes a mistake. The pattern is still really clear: five spots account for almost all of the crashes.

The submitted line’s own crashes happen in the same places. In my last 70 runs, the first hit kept landing on the same three waypoints: 1420 five times, 521–522 four times, and 894–895 three times.

If a car keeps crashing at the same waypoint, that is a problem with the line, not bad luck.

The room map

Figure 3. Where every completed run was across the track at each station. Pale band: anywhere any run drove, at any speed. Dark band: only ticks at 90 % or more of the shipped line's race pace. Gray: the LIDAR barrier. Black: the shipped line. The track is straightened out, so the vertical axis is distance left or right of the centerline. Panels A and B zoom in on the two worst tight spots.

The room map answers two questions: where has a car actually driven, and how fast was it going? My first version got this wrong in two different ways.

  • The first “envelope” came from a test script with its steering sign flipped. It recorded wherever a slow car happened to drive, not where the walls are. The submitted line goes outside it at a third of all stations. I locked it out in the code so nothing can use it as a wall boundary.
  • A filter bug counted every crashed run as “safe”. The crash flag is in summary.json, not ticks.csv, so filtering on the tick file let every run through.

The fix was to measure the walls directly. The LIDAR sensor in the pinned version of ROAR_PY does not work out of the box, which is probably why nobody used it in earlier seasons. Once I got it working, one unscored lap picked up the barrier on 100 % of ticks on both sides. The real track is narrower than the official 12 m almost everywhere: 11.29 m wall to wall on average (median), and 10.33 m at the narrowest. Using the 12 m width, the crash site had ranked only twentieth-tightest. With the real walls, the crash site had the four tightest margins on the whole lap.

The main takeaway from this map is the difference between the two bands. Across all stations, the median width is 4.06 m at any speed but only 0.56 m at race pace. Most of the “drivable” road is only used by slow runs. At racing speed, there is much less room than it looks like. In the version built from the first 147 runs, only 16.8 % of stations had at least 0.3 m of room on the inside of the turn.

Where I pushed further. The dark band is only wide in a few places, like s ≈ 3500–3700 m and s ≈ 5000–5200 m. Those runs came from my early controller in the first weeks, which followed the centerline instead of the racing line and was within 10 % of race pace on those parts. So the map does show that a car can be 3–4 m off the shipped line at speed in some places. But those parts are almost straight, and where you are on a straight barely matters for lap time.

The two zoomed panels show the tight spots. At s ≈ 1060–1090 m the race-pace band is squeezed to within a meter of both walls. In section 5, it touches the right wall for 70 m.

The map also explained one of my earlier failures. Early on, I had tried shifting the line by the same amount across a whole section, and 7 of 9 of those runs crashed. In every one of the ten sections, the smallest amount of inside room is somewhere between −0.09 and +0.07 m. A shift that is the same across a whole section cannot be bigger than the room at that section’s tightest point, so there is basically nowhere to shift to. I checked the map against all seven crashes, and it predicted every one of them.

The clearance map

Figure 4. How close the car's body gets to the LIDAR barrier, for the shipped line and the two-knot line (see 5.2), worst of three laps. The car is treated as a box, and each of its four corners is placed using the car's actual heading. Top: the whole lap as one strip, blue where the two-knot line has more room and orange where it has less. The arrows mark each line's worst point on the lap. Bottom: boxes A and B, zoomed in. The shaded area is closer than the measured barrier line.

What makes the car crash is not how far the center of the car is from the wall. It is how far the corner of the car’s body is. When the car is angled through a turn, its rear corner swings out wider than its center.

My first clearance calculation ignored the car’s heading. Once I added it, the order of the tightest spots flipped, and the new order matched the crash counts. The car’s half width (1.0817 m) comes from CARLA.

Running this for every station on the lap showed two things:

  1. The shipped line is up against a wall somewhere in almost every 50 m. This controller does not have room to spare.
  2. The margins are tiny. The car loses a little clearance each lap because it is going about 2 km/h faster. At one spot, the difference between a clean run and a crash was 0.006 m: −0.200 m finished, −0.206 m crashed.

The most useful thing this map taught me is that changing the line in one place affects the whole lap. A −1.0 m change at s ≈ 4050 m still moved the car 0.69 m at s ≈ 1900 m and 0.37 m at the section-1 squeeze. The controller remembers things from earlier in the lap (a braking countdown, smoothing windows, where it is on the line), so a small change can still show up a lap later.

The strip at the top of Figure 4 shows this. The two knots only change the line inside boxes A and B. But the two-knot car also has more room in some places and less in others around S7, near turn 11’s exit, more than a kilometer later.

So I made a rule: judge a new line by its tightest point anywhere on the lap, over every station of every lap, and never just by the spot you were trying to fix. In one batch, the version with the best clearance at its own target was the only one that crashed, 755 m away.

How I picked the final line

Which line does the car actually follow?

For my first line experiments, I edited waypoints in the bench and exported them. The car barely moved: a 4.5 m shift changed its path by 3 cm. That is how I found the most important thing about how the code handles the line. The solution has three separate copies of the racing line:

The steering takes the waypoint picked from the first file and snaps it onto the third. So the bench was editing the file that decides which point gets picked, not where that point is. Seven winning repositories used the same .npz file, and it seems nobody ever needed to notice this.

I rewrote the line-shift code to change the 5865-point line directly, so every part of the code uses the same line. With the new code, the car moved by exactly as much as I asked. It also behaved exactly the same, tick for tick, as the rougher shift it replaced. That proved my theory about why the rougher version had crashed was wrong, and I wrote that down in the log.

One knot is not enough

Now that I had a way to actually move the car, I aimed it at the tightest spots on the clearance map. Each shift is a knot: a smooth sideways bump that fades in and out (a raised-cosine shape), similar to what the first-place team this season used.

One knot fixes its own spot perfectly, but then the tightest spot just moves somewhere else. Two knots raise the tightest point on the whole lap, and together they only cost 6 ticks instead of the 13 you would get by adding up their separate costs. Before the run, I predicted the lap’s tightest point would end up between −0.13 and −0.14 m. It came out at −0.136 m. That was the first time any of my line models correctly predicted a number ahead of time.

Figure 4 shows this comparison. In panels A and B, the blue line rises out of the orange dips at s ≈ 1075 m and s ≈ 2895 m. Knot 1 also helps a little at the next two section-5 corners. The arrows on the strip show the lap’s worst point moving from section 5 to the final corner, which neither knot touches.

Sixty back-to-back pairs

Clearance is not proven to predict crashes when the viewer is on, so the geometry alone was not enough to pick the two-knot line. I raced it against the shipped line in 60 back-to-back pairs: alternating every run, viewer on, CARLA restarted before every run, over five batches and two separate reboots of the computer.

The change that mattered most: surviving a crash

With the viewer on, which is how the grader runs, the inherited line had a major crash in about 1 run in 5. I measured 26 crashes in 133 runs: 19.5 %, with a 95 % confidence interval of 13.7–27.1 %.

Before my fix, a crash meant no score at all. I found out why after watching one run use up the entire 5000 s race timeout:

WaypointLine.find_closest_index only searches 50 waypoints either side of where it last was. respawn() teleports the car about 485 m back to the start line. After the teleport, the controller steers toward a point about 1900 m away, never finds the line again, and drives around until time runs out.

Every solution in the lineage has this bug. You never see it on a clean run, and clean runs are the only ones anyone looks at.

The fix is about ten lines, and it only runs when it detects a teleport:

  • work out the section index again;
  • find the car’s place on the racing line by searching the whole line;
  • reset the throttle controller’s saved values (brake countdown, previous speed, smoothing windows, section-3 latch) to their starting values.

The fix costs nothing on a clean run, because that code never runs. Canaries still come back at exactly 6397 ticks.

A DNF costs about 245 s of expected score. Compared to that, this fix was worth about ten times more than all of my lap-time work put together.

Results

The podium was 319.65 / 319.85 / 320.15 s. All three of us wrote, in different ways, that this season came down to careful measuring, not a new algorithm.

What I would tell next season's teams

  1. Read competition_runner.py, not just the documentation. The tick clock, the gear setting that does nothing, and how respawn works are all in the code.
  2. Fix the respawn bug first. It is ten lines, it is in every fork, and with about 19 % of runs crashing with the viewer on, it is worth more than any lap-time change.
  3. Know which line the car follows. Editing waypointsPrimary.npz moves the car by centimeters. The steering follows WaypointLine.line_locations.
  4. Measure the walls. The official 12 m lane is about 0.7 m too wide almost everywhere and 1.7 m too wide at the narrowest point. One LIDAR lap fixes that for the whole season.
  5. Put every crash on one map. My 148 crashes came down to five places. That tells you more than any single run.
  6. Judge a line change over the whole lap. What matters is not the clearance where you made the change; it is the tightest point on the whole lap. Line changes can affect the car hundreds of meters later.
  7. Alternate runs, restart CARLA, and use canaries. I spent about a third of my season undoing conclusions from batches that broke one of these rules.
  8. Write down your stop rule before you run. Sometimes it will make you take back something you liked. That is what it is for.

Acknowledgements

Thank you to the ROAR organizers at UC Berkeley for running the series, and to every team whose work is in this controller: the Spring 2026 winners, whose entry I started from, and the earlier teams whose racing line has gone unchanged through seven winning repositories.

Primary Sidebar

Recent News

  • The 2027 ROAR Ambassadors
  • AI Racing Tech Places Third in the Indy Autonomous Challenge Laguna Seca 2026
  • Fall 2026 ROAR Simulation Racing Series Competition due Dec. 11, 2026
  • Summer 2026 Simulation Racing Series Results​
  • Contact
  • FHL Vive Center
  • Berkeley Engineering
  • UC Berkeley
  • linkedin
  • youtube
  • facebook
  • instagram
  • Privacy
  • Accessibility
  • Nondiscrimination

© 2026 UC Regents  |  Log in