Risk-Aware Generation of Static Highway Scenarios for Autonomous Vehicle Testing
TL;DR: Most scenario generators for autonomous-vehicle testing change the traffic and keep the road fixed. I generate the road itself. Topo-DiffRoad produces realistic highway mainlines, ramps and interchanges with controllable risk geometry (curvature, grade, vertical curves) and exports them straight to CARLA. In closed-loop tests, these roads caused far more tracking errors and lane departures than existing test maps.
Motivation
Simulation-based testing of autonomous vehicles (AVs) mostly varies the dynamic parts of a scene: cut-ins, pedestrians, aggressive drivers. The road usually stays a fixed background. On highways, though, the road itself is a major risk factor. At high speed and with long braking distances, sharp horizontal curves, steep grades and short vertical curves amplify small control errors into lane departures and crashes.
Existing road generators mostly target urban intersections and cannot control these alignment properties directly. That leaves a gap: there was no way to generate realistic highway roads that are risky by design, which is exactly what is needed to stress-test AV control stacks.
Approach
The work closes the loop from crash data to test scenarios: identify which road features drive crashes, generate roads with those features, and verify in simulation that the generated roads really are harder to drive.
1. Real highway data
I built a dataset of 1,937 highway scenes from OpenStreetMap covering the full freeway networks of Washington, Oregon and California. It has three scene types: 1,228 mainline segments, 382 ramp junctions and 327 complex interchanges. Interchanges were located by clustering motorway-junction nodes with DBSCAN. Each scene was cropped, projected to UTM and resampled to fixed-length centerlines.
2. Topo-DiffRoad: a two-stage conditional diffusion model
Generating a multi-road interchange in a single diffusion pass tends to produce misaligned endpoints and broken connections. I therefore split generation into topology and geometry:
- Stage 1 (SkeletonNet, Transformer): generates the endpoint skeleton, i.e. the start and end points of every road in the scene. This fixes how roads connect, run in parallel or cross.
- Stage 2 (RoadGenNet, 1-D U-Net): generates each road’s full centerline, conditioned on the skeleton, the scene type and a target maximum curvature. The network uses per-road endpoint embeddings, bottleneck self-attention, FreeU re-weighting on skip connections, and a smoothness regularizer on the predicted geometry.
Both stages use DDPM with v-prediction and a cosine noise schedule.
3. From risk factors to a drivable 3D scene
Risk factors identified from crash-frequency modelling (see the related project below) enter the pipeline at three levels:
| Risk factor | How it controls generation |
|---|---|
| Horizontal curvature, scene type | Condition vector of the diffusion model |
| Grade, vertical-curve length | Rule-based elevation profile following AASHTO design standards, sampled inside crash-derived high-risk ranges |
| Lane count, lane width | Cross-section parameters written into the OpenDRIVE file |
The output is a standard .xodr file that loads directly into CARLA or SUMO, with elevations aligned at every junction.
4. Closed-loop testing in CARLA
To isolate the effect of road geometry, I ran single-vehicle closed-loop tests: no other traffic, a fixed vehicle (Tesla Model 3) at 72 km/h, and two lateral controllers, LQR (optimal control) and Stanley (geometric feedback). Generated scenes were compared against DiffRoad (a state-of-the-art road generator), CARLA Town04/06 and CommonRoad real-road scenarios.
Results
Realistic, topologically valid roads
| Model | HD ↓ | JSD length ↓ | JSD spacing ↓ | JSD curvature ↓ | Smoothness ↓ |
|---|---|---|---|---|---|
| CGAN | 8.329 | 0.693 | 0.567 | 0.339 | 5.612 |
| VAE | 1.685 | 0.286 | 0.053 | 0.454 | 0.0375 |
| DiffRoad | 0.731 | 0.038 | 0.026 | 0.102 | 0.00073 |
| Topo-DiffRoad | 0.737 | 0.032 | 0.023 | 0.057 | 0.00005 |
Topo-DiffRoad matches the real distributions of road length, point spacing and curvature most closely. Curvature JSD drops by 44% compared with DiffRoad, and centerlines are about 15× smoother. Hausdorff distance is on par with DiffRoad.
Harder for controllers to drive
- Generated scenes cover risk geometry that existing maps rarely contain: most reach grades of 4–5.5%, and maximum curvature ranges from 2.5 to 25.7°/100 ft.
- Mean lateral tracking error was ~3.5× (LQR) and ~4.5× (Stanley) that on DiffRoad scenes, and higher still than on CARLA Town and CommonRoad.
- Road geometry translates directly into control difficulty: heading change rate correlates with mean lateral error at Spearman ρ = 0.97 (LQR) / 0.94 (Stanley).
More safety-critical events
My role
Sole author of the thesis. I designed and built the OSM data pipeline, the Topo-DiffRoad model, the rule-based 3D and OpenDRIVE generator, and the CARLA evaluation framework and metrics.
Limitations and next steps
- Region transfer: risk thresholds were calibrated on U.S. crash and map data; applying the method to other road networks (e.g. China) needs local calibration.
- Beyond geometry: the scenes contain the road only. Adding guardrails, signs, vegetation and occlusion would allow testing perception and localization, e.g. sight-distance-limited curves.
- Richer testing: combining the risky road networks with dynamic traffic, and evaluating end-to-end driving stacks rather than only lateral controllers.
Related project
The risk factors and thresholds used here come from my crash-frequency modelling work: Traffic Crash Data Augmentation with Multi-type Variables using Hybrid VAE-Diffusion Generative Neural Networks for Enhancing Crash Frequency Modeling, Accident Analysis and Prevention, 2026 (co-first author). It used SHAP on the augmented crash model to identify curvature, grade and vertical-curve length as key risk factors for high-crash highway segments.