Compiling OpenSCENARIO 2.1 for Scenario-Based Testing in CARLA
Organizations: Department of Computer Science, Southern Illinois University Edwardsville, Edwardsville, IL · Department of Computer Science, Webster University, Webster Groves, MO
Abstract
While the ASAM OpenSCENARIO 2.1 Domain-Specific Language (DSL) enables declarative, intent-driven authoring for Scenario-Based Testing (SBT), its integration into open-source simulators like CARLA remains limited by legacy parsers. We propose a multi-pass modern compiler architecture that translates the OpenSCENARIO 2.1 DSL directly into executable CARLA behaviors. The pipeline features an ANTLR4 frontend for Abstract Syntax Tree (AST) generation, a semantic middle-end, and a runtime backend that synthesizes deterministic py_trees behavior trees. Mapping the standardized domain ontology directly to CARLA's procedural API via a custom method registry eliminates the need for external logic solvers. A demonstrative multi-actor cut-in and evasive maneuver, selected from a wider suite of validated scenarios, confirms the compiler's ability to process concurrent actions, dynamic mathematical expressions, and asynchronous signaling. This framework establishes a functional baseline for reproducible, large-scale SBT, paving the way for future C++ optimizations to mitigate current Python-based computational overhead.
Figures & tables
| Feature | OSC 1.3 (XML) | OSC 2.1 (DSL) |
|---|---|---|
| Format | Schema-based (XML) | Text-based DSL (EBNF) |
| Hierarchy | Storyboard Act Maneuver Event Action | Declarative, intent-driven structure |
| Logic | Trigger-based conditions | Full expressions, conditions, and logic |
| Parameterization | Parameters and catalogs | Native variables and reusable abstractions |
| Modularity | Limited reuse via catalogs | High modularity and composability |
| Behavior Modeling | Explicit action definitions | Actions + Modifiers + Conditions separation |
| Category | Capability | Description | Implementation Method | Supported |
|---|---|---|---|---|
| Action Framework | Action lifecycle | Start, end, fail states | Behavior Tree status tracking | |
| Actor binding | Map actions to actors | Runtime execution context | ||
| Composition | Sequential/parallel | Tree composites (serial/parallel) | ||
| Duration handling | Time bounds | Parallel timeout wrappers | ||
| Movement | Move/drive/walk | Motion primitives | LocalPlanner/WaypointFollower | |
| Speed control | Adjust speed | PID longitudinal control |