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)

What’s next

The runner, the language server, and the VS Code extension work today. This is the piece being built on top of them.

  1. Browser playground

    in design

    Edit a .osc file in the browser, run it against a sample map, and see the result — with nothing installed. Meant for trying the language out, reproducing a scenario in a bug report, and sharing a situation with someone by sending them a link.

Questions go to the issue tracker

The osc2r2 source is not public, so the issue tracker on this site’s repository is where questions about the toolchain are answered — what it supports, how to use it, and what it should do next. There is a template for each kind.

Issues are public. Anything you cannot publish — a customer scenario, a map, a security problem — should go through a private advisory instead.