ASAM OpenSCENARIO 2.0 · ASAM OpenDRIVE

Write driving scenarios.
Watch them run.

osc2r2 is a toolchain for ASAM OpenSCENARIO 2.0. It gives you a language server that understands your .osc files while you type, a deterministic runner that executes them on OpenDRIVE road networks, and a 3D viewer to see the result.

Available now

The editor half, in one click

OpenSCENARIO 2.0 packages the language server as a VS Code extension. Install it and .osc files are understood as you type — no local toolchain to build, nothing to configure.

It is the same language server described below, so the errors the editor shows you are the errors the rest of osc2r2 sees.

Listed as OpenSCENARIO 2.0, extension ID okchan08.openscenario2

code --install-extension okchan08.openscenario2

Copy the command ⌘P on macOS or Ctrl+P elsewhere, paste the line, and press Enter. Or search the Extensions view for OpenSCENARIO 2.0.

One toolchain, four parts

Scenario work spans authoring, execution, and inspection. osc2r2 covers all three against the same front-end, so what your editor tells you and what the runner does never drift apart.

Language server

A full LSP implementation for OpenSCENARIO 2.0, so any LSP-capable editor gets real feedback on .osc files. Packaged for VS Code — install it here.

  • Diagnostics from lexing, parsing, and semantic analysis
  • Hover, go-to-definition, and document outline
  • Completion and signature help
  • Find references and rename across the workspace
  • Semantic highlighting

Scenario runner

A fixed-timestep executor that turns a scenario into motion and reports what happened.

  • Deterministic: same input and seed, same result
  • Headless mode with a printable run report — fits in CI
  • Actions, modifiers, and keep constraints
  • Serial and parallel composition with real completion conditions

OpenDRIVE support

Scenarios run on real road networks, not an abstract plane.

  • Geometry: lines, arcs, spirals, and polynomials
  • Elevation, superelevation, and lane height
  • Lanes, lane sections, borders, and offsets
  • Junctions with explicit route selection

3D viewer

See the map and the scenario, not just a log file.

  • Render an OpenDRIVE network on its own
  • Watch a scenario play out in the same view
  • Hover a road to identify it

Say what should happen,
not how to compute it

OpenSCENARIO 2.0 describes traffic situations declaratively. You state the constraints — a speed, a gap, a lane change, how long a phase lasts — and the runner finds motion that satisfies them.

The scenario alongside puts two vehicles on a two-lane road. The lead car holds 30 kph for 120 m. The follower starts 25 m behind it, runs 5 kph faster to close the gap, then changes lane after ten seconds. Nothing here computes a trajectory by hand.

osc2r2 reads the ASAM standard library, so scenarios written against the published vocabulary run as-is.

scenario main:
    lead: vehicle
    follower: vehicle

    do parallel:
        lead.drive() with:
            speed(30kph)
            distance(120m)

        serial:
            follower.drive() with:
                position(25m, behind: lead, at: start)
                speed(5kph, faster_than: lead)
                until elapsed(10s)

            follower.drive() with:
                speed(5kph, faster_than: lead)
                change_lane(side: left)
                distance(80m)

The whole loop, in the browser

Write a .osc file, run it against a sample map, and watch the result — with nothing installed. The language server, the runner, and the 3D viewer are all on the one page, which makes it the short way to try the language out, to reproduce a scenario from a bug report, or to hand someone a situation as a link.

Eighteen seconds, no sound: a two-lane merge run in the playground and followed through the overtake. Open the playground.

Questions or requests

In the case you have questions or requests regarding the osc2r2 toolchain, please use the issue tracker on this site’s repository.

Please note that issues are public. Anything you cannot publish, for instance a customer scenario, a map, or a security problem — should not be included in an issue.