Skip to content
cccskills
FreePublished on GitHub

create-scenic-scenario

Turn a written traffic situation into a Scenic file, which describes possible scenes using placement rules and constraints. Select suitable maps and actors, then check that the file compiles and can generate at least one scene.

OriginalShow the original description

Writes a new Scenic scenario (.scenic) from a natural-language description — "a car cuts in from the right lane", "a pedestrian crosses in front of the ego", "negotiate an unsignalized four-way" — by turning the request into a spec, generating the file from idioms proven on this build, and validating it by compiling and sampling before any simulator is involved. Use when the user asks to "write a Scenic scenario", "create a .scenic file", "turn this description into Scenic", "generate a scenario from text", or wants a Scenic scenario authored or repaired.

See how to install

Good for

  • Create a scenario with a car cutting in from the right
  • Describe a pedestrian crossing ahead of the main vehicle
  • Build an unsignalized intersection scenario
  • Repair a Scenic file that cannot generate scenes

Files included (7)

  • SKILL.md9.4 KB
  • assets/scenario.scenic.template864 B
  • references/language.md5.3 KB
  • scripts/blueprint_table.py5.1 KB
  • scripts/check_env.sh5.9 KB
  • scripts/env.sh4.9 KB
  • scripts/scaffold_scenic.py12.8 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Create a Scenic scenario from a description

Paths. scripts/… and references/… below are relative to the directory holding this SKILL.md. Your working directory is the user's project, not that directory, so prefix them with its absolute path or the command is not found.

Scenic describes a distribution over scenes, not one scene. So a good scenario is not a script of positions — it is a set of constraints loose enough to sample and tight enough to be the situation asked for.

Translating a request has three parts, and only the first is a judgement call:

  1. request → spec (yours): pick the map, the placement, the actors and their relations.
  2. spec → file (scripts/scaffold_scenic.py): emits boilerplate and placement idioms lifted from scenarios that run on this build.
  3. validate (same script): compile, then sample. No server needed.

Do not hand-write the boilerplate. Three things bite every time and the generator already handles them:

  • assert len(x) > 0 is illegal on a random value. Anything derived from a Uniform(...) raises RandomControlFlowError. Only assert on lists built deterministically from network.
  • Pedestrians and props need with regionContainedIn None when placed on the road. Containment is re-checked every sample, so without it generation never converges — it looks like an unsatisfiable require.
  • param map and param carla_map must name the same town. map builds the road network; carla_map tells CARLA what to load. Disagree and the scene is sampled on one map and simulated on another.

Instructions

Progress:
- [ ] Step 1: Check prerequisites (bash scripts/check_env.sh)
- [ ] Step 2: Pick a map that can express the situation
- [ ] Step 3: Pick blueprints that exist in THIS build
- [ ] Step 4: Write the spec, generate, and let it validate
- [ ] Step 5: Loop on the verdict until it samples; then simulate

Step 2: The map has to support the situation

A scenario selects road features. If the map has none of them, no wording will save it — the generated filter matches nothing and compilation fails with tried to make discrete distribution over empty domain.

python3 ../run-scenic-scenario/scripts/list_scenic.py --check-maps

Read the 4way=N(uns M) / 3way=N(uns M) columns. Junction-negotiation scenarios need uns > 0; dense downtown maps are usually fully signalized.

Step 3: Blueprints that exist here

python3 scripts/blueprint_table.py                      # inventory + gaps
python3 scripts/blueprint_table.py --category bicycle   # ids Scenic offers
python3 scripts/blueprint_table.py --list vehicles      # what the build has
python3 scripts/blueprint_table.py --check vehicle.lincoln.mkz vehicle.lincoln.mkz_2017

Two lists, and they disagree. blueprint_table.py reads the build's own Content/Carla/Config/*Parameters.json — the definitive inventory — and diffs it against Scenic's table for the installed client version.

  • A category Scenic reports empty makes new Bicycle fail at sample time even when the build has bicycles. Name the id instead: with blueprint "vehicle.bh.crossbike".
  • An id in the build but absent from Scenic's table is still spawnable — reference it explicitly.
  • An id in neither fails at spawn time, long after sampling passed. This is how the upstream scenarios still carrying vehicle.lincoln.mkz_2017 behave.

Step 4: Spec, generate, validate

python3 scripts/scaffold_scenic.py --example > spec.json   # start from this shape
# edit spec.json
python3 scripts/scaffold_scenic.py --spec spec.json --out my.scenic

Generating with --out validates automatically. To re-validate after a hand edit:

python3 scripts/scaffold_scenic.py --validate my.scenic

Spec keys:

KeyMeaning
maptown name; needs a matching .xodr in the assets (required)
modelsrunner (default) or scenic — see [[run-scenic-scenario]]
placementlane for road situations, intersection for junction ones
arms, signalizedintersection filter; signalized: false for negotiation
ego{blueprint, speed, maneuver}; maneuver is straight/left/right
actors[]{name, type, blueprint, relation, distance, speed, maneuver, offset, threshold}
requires[]extra require lines, verbatim
terminatetermination condition; defaults to leaving the spawn area

relation decides the geometry, and each maps to a proven idiom:

relationGeometry
ahead / behindfollowing roadDirection from ego for ±Range(lo, hi)
right_lane / left_laneselects lane sections with that neighbour, places there
conflictinga conflicting maneuver through the same intersection
crossinganchored crossing: ego starts back up the lane, actor crosses it

Step 5: Loop on the verdict

VerdictMeaningFix
PASS sampled in N iterationsdone — simulate it[[run-scenic-scenario]]
COMPILE-FAIL ... empty domainmap lacks the featurechange map, or relax arms/signalized
COMPILE-FAIL RandomControlFlowErrora comparison on a random valuehand-edited assert — remove it
COMPILE-FAIL ... no 'X' blueprints recordedScenic category emptyname a concrete blueprint
SAMPLE-FAIL RejectionExceptionrequirements jointly unsatisfiableloosen the tightest require, widen distance

Simulating is a separate, explicitly-requested step — generating a validated scenario is this skill's deliverable. Run it with [[run-scenic-scenario]].

Examples

Example 1: "a car cuts in front of me from the right lane"

placement: lane, one actor with relation: right_lane. The generator selects lane sections that have a right neighbour, because only sections know their neighbours — network.lanes does not. Samples in single-digit iterations on Town05.

Example 2: "a pedestrian steps into the road ahead of the ego"

relation: crossing, type: Pedestrian. Uses CrossingBehavior(ego, speed, threshold) so the walker waits until the ego is threshold metres away, and adds regionContainedIn None. relation: ahead with a Pedestrian would sample forever instead.

Example 3: "negotiate an unsignalized four-way with a car on a conflicting arm"

placement: intersection, arms: 4, signalized: false, one actor with relation: conflicting. Check --check-maps first: on a map whose only four-way is signalized this cannot compile, which is exactly why the shipped carlaChallenge10 fails on Town10HD_Opt.

Troubleshooting

Problem: RandomControlFlowError: random values cannot be compared Cause: a comparison — usually assert len(...) > 0 — on something derived from a Uniform(...). Scenic evaluates the scenario symbolically, so control flow cannot depend on a sample. Solution: assert only on lists built by a plain loop over network.*. The generator never emits the illegal form.

Problem: sampling never converges on a scenario with a pedestrian or a prop Cause: the default containment region. The object is being placed on the road but must lie in the walkable region, so every sample is rejected. Solution: with regionContainedIn None.

Problem: no <Town>.xodr found Cause: the generator resolves the OpenDrive from SCENARIO_RUNNER_ROOT/srunner/scenic/assets and a Scenic checkout's assets/maps/CARLA. Solution: set those roots, or pass "xodr" in the spec explicitly.

Problem: the scenario samples but nothing spawns when simulated Cause: a blueprint id that does not exist in this build. Ids are resolved at spawn time, so sampling cannot catch it. Solution: scripts/blueprint_table.py --check <id> ... on every id in the file.

Problem: a hand-written terminate when never fires Cause: it references an object that has moved, or a distance that never grows. Solution: keep the generated form — distance from the spawn point, which always grows once the ego drives — and always bound the run with --time anyway.

Outputs

A .scenic file that compiles and produces at least one sampled scene, with the blueprints of that scene printed so they can be checked against the build. The file is ready for scenic FILE --simulate --2d via [[run-scenic-scenario]].

The language constructs this model actually supports — object classes, behaviors, spatial operators, requirement forms — are in references/language.md.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Add a message type to CARLA's native ROS 2 interface. Create its C++ data structure, serialization code for transmission, type identity hash, registration, and tests, with Docker-based hash calculation and build checks.

  • Adding a standard ROS 2 message type missing from CARLA
  • Defining a custom carla_msgs message
  • Investigating type-hash warnings
carla-simulator/carla14.5KUpdated Oct 18, 2026

Extend CARLA’s native ROS 2 interface to publish sensor data or receive vehicle commands. Covers topic implementation, registration, data connections, and verification, plus adding middleware, the communication layer used to exchange messages.

  • Publish obstacle sensor data to ROS 2
  • Add a topic for vehicle speed commands
  • Integrate another communication middleware
carla-simulator/carla14.5KUpdated Oct 18, 2026

Summarize ScenarioRunner results to see which scenarios passed and which checks failed. Compare runs before and after changes, or analyze recorded driving to produce measurements and plots of vehicle distance and deviation from the lane center.

  • Checking scenario pass and fail results
  • Comparing results before and after controller changes
  • Plotting vehicle distances from a recorded run
carla-simulator/carla14.5KUpdated Oct 18, 2026

audit-carla-docs

FreeSummary

Checks a local CARLA checkout for missing API documentation, outdated references, broken links, and pages absent from navigation. Produces a grouped Markdown report without building the project or running the simulator.

  • Reviewing documentation before a release
  • Finding missing or outdated API references
  • Checking broken links and navigation gaps
carla-simulator/carla14.5KUpdated Oct 18, 2026

bounding-boxes

FreeSummary

Read and display CARLA object bounding boxes, then project them onto a camera image as 2D rectangles. Export an annotated PNG and box coordinates in JSON for object detection annotation work.

  • Adding vehicle boxes to a camera image
  • Exporting box coordinates for detection annotations
  • Checking vehicle dimensions
carla-simulator/carla14.5KUpdated Oct 18, 2026

build-carla-ue4

FreeSummary

Builds CARLA's ue4-dev branch on Linux, producing the Unreal Engine 4.26 editor, server modules, and an installed Python client package. Fetches required content, optionally compiles native ROS 2 support, and verifies the build against a source-built server.

  • Building CARLA ue4-dev from source
  • Compiling CARLA with native ROS 2 support
  • Building the Python client for an existing environment
carla-simulator/carla14.5KUpdated Oct 18, 2026

See all skills by carla-simulator

Report a problem with this skill