Creates and edits RoadRunner scenarios in MATLAB via roadrunnerAPI: add actors, routes, phase logic, validate, or recreate OpenSCENARIO 1.x (.xosc) files as editable scenarios.
Ships in automotive. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Programmatically create RoadRunner scenarios from MATLAB: actors, routes, phase logic, and validation — all via roadrunnerAPI. Build from a user description, or recreate an OpenSCENARIO 1.x (.xosc) file.
roadrunner-manage-projectmatlab-use-scenario-buildermatlab-use-ncap-protocolroadrunner-build-rrhd-maproadrunner-build-rrhd-map (the .xodr a .xosc references is imported by this skill, with noprojection)roadrunner-simulate-scenarioimportScenario(rrApp, xoscPath, "OpenSCENARIO XML") directly; do not rebuild itexportScenario(rrApp, "scenario.xosc", "OpenSCENARIO XML") directlydrivingScenario objects or Driving Scenario Designer sessions (Automated Driving Toolbox, not RoadRunner)Clarify, then proceed (the one rule on confirmation): complete this step before writing code — scenarios built without pre-analysis fail on timing, missed collisions or triggers that never fire. If the request is fully specified (actors, scene, speeds, distances or timing, intended outcome) or the user says not to wait, state the plan in two or three lines and proceed, reporting your judgment calls. If something outcome-defining is missing or contradictory, ask only about that and wait for the answer.
Check intent: actors and roles (ego/target), desired outcome (collision, near-miss, safe completion), speeds, distances or timing, scene.
Physics first (required for timed interactions): follow references/physics-first-design.md: timeline → measure the scene (HD map) → derivation table → verify every trigger can fire → code.
ScenarioType="following"), adjacent lanes ("cut-in"), crossing paths ("crossing").required_gap = maneuver_distance + closing_rate × maneuver_time + 5 m (about one car length).If rrApp does not exist or is invalid, you MUST invoke the roadrunner-manage-project skill (it runs rrAppInitialize). Never call roadrunner, roadrunner(ProjectFolder=...) or roadrunner.connect() yourself — that creates duplicate RoadRunner instances. Set skillDir to the folder that contains this SKILL.md.
if ~exist('rrApp', 'var') || ~isvalid(rrApp)
error("roadrunnerAuthorScenario:NoSession", ...
"STOP: rrApp is missing. Invoke the roadrunner-manage-project skill now.");
end
addpath(fullfile(skillDir, "scripts")); % helper functions (references/helper-scripts.md)
Release check: RemoveActorAction, SynchronizeAction and setupCollision need RoadRunner R2026a or later, and setActorWorldAnglesDegrees (source headings in .xosc recreations) R2026b Update 1; the API comes from the connected RoadRunner (rrApp.Version). If the user's release, or one the script must also run on, is older, guard them with exist("roadrunner.api.RemoveActorAction", "class") == 8 or use an alternative, and tell the user (references/actions-and-conditions.md §RemoveActorAction).
openScene and newScenario discard an unsaved scenario without asking (verified in R2026b). Once, before your first call in the task, check s = status(rrApp): if isstruct(s.Scenario) && s.Scenario.UnsavedChanges, the user has unsaved work, so ask whether to save it (saveScenario) or discard it, and wait for the answer. Never decide yourself, even if the changes look like leftovers from earlier work. Your own build script can re-run freely.
openScene(rrApp, sceneName);
newScenario(rrApp);
rrApi = roadrunnerAPI(rrApp);
rrs = rrApi.Scenario;
phaseLogic = rrs.PhaseLogic;
rrprj = rrApi.Project;
Survey the scene for valid lane positions before placing actors (manual HD Map queries: references/scene-awareness.md):
sceneInfo = helperSceneAwareness(rrApp, NumActors=2, ScenarioType="cut-in");
% 2+ actors: batch place, anchor, set speed and verify
actorSpecs(1) = struct(Name="Ego", AssetPath="Vehicles/Sedan.fbx", ...
AssetType="VehicleAsset", LaneIndex=1, Fraction=0.2, Speed=15);
[actors, report] = helperPlaceActors(rrs, rrprj, phaseLogic, sceneInfo.HDMap, actorSpecs);
ego = actors{1}; % cell array — use curly braces
% Single actor
actor = addActor(rrs, getAsset(rrprj, "Vehicles/Sedan.fbx", "VehicleAsset"), position);
actor.Name = "Ego";
autoAnchor(actor.InitialPoint); % snaps to the lane centre
shift = norm(actor.InitialPoint.WorldPosition(1:2) - position(1:2)); % > 0.5 m = jumped lanes (#19)
Asset paths, props, and vehicles not in the catalog: references/asset-catalog.md.
% Scene anchor: findSceneAnchor returns the point (remapAnchor instead moves an existing scenario anchor)
anchors = getAnchors(rrApp);
anchorPt = findSceneAnchor(rrs, anchors(1).Name);
anchorToPoint(actor.InitialPoint, anchorPt);
actor.InitialPoint.ForwardOffset = 20;
actor.InitialPoint.LaneOffset = 1;
% Relative to another actor
anchorToPoint(target.InitialPoint, ego.InitialPoint);
target.InitialPoint.ForwardOffset = 30;
Without scene anchors, autoAnchor an HD-map position (within 5 m of the road).
Routes put actors in path-following mode; actors without routes drive in lane-following mode along their lane.
route = actor.InitialPoint.Route;
% Waypoint further along the actor's own lane (same laneIdx as placement; fraction 0.2-0.8)
fwdPt = addPoint(route, helperGetPositionFromHDMap(sceneInfo.HDMap, laneIdx, 0.6));
autoAnchor(fwdPt, PosePreservation="reset-pose");
for i = 1:numel(route.Segments)
route.Segments(i).Freeform = false; % road-following vehicles follow the road surface
end
ChangeLaneAction or ChangeLateralOffsetAction (lane-following only).autoAnchor on HD-map positions, never anchorToPoint + ForwardOffset (it discards the computed position). Junction turns: several waypoints along one connected arm.Freeform = true only for pedestrians, off-road or airborne segments, and an oncoming car driving against its lane (references/routes-and-points.md).HasTime/Time on waypoints (references/routes-and-points.md §Time-Based Trajectory).Full action and condition catalog, and what cannot be authored from MATLAB (traffic signals, time-to-collision and parameter conditions, environment) with the fallback to offer: references/actions-and-conditions.md.
initPhase = initialPhaseForActor(phaseLogic, actor); % auto-created; already has a ChangeSpeedAction
initPhase.Actions(1).Speed = 20;
nextPhase = addPhaseInSerial(phaseLogic, initPhase, "ActorActionPhase");
nextPhase.Actor = actor; % REQUIRED — never omit
cond = setEndCondition(initPhase, "LongitudinalDistanceToActorCondition"); % trigger
cond.Actor = actor; % REQUIRED
cond.ReferenceActor = otherActor;
cond.Distance = 10;
action = addAction(nextPhase, "ChangeLaneAction");
action.Direction = "left";
When does a phase end? Each actor's phase chain is independent. With an end condition, a phase ends when the condition becomes true. Without one, it ends when its action completes (verified in R2026b simulation):
SamplingMode="action-start"): ends at the goal. For "A, then B once A is done", leave A's end condition empty.SamplingMode="continuous"): never ends, so the next phase never starts unless it has an end condition. validate() does not flag this.Run helperCheckScenarioStructure(rrs) first: it flags mistakes validate() misses. validate returns true or throws; in R2026b Update 2 the per-object diagnostics are attached as ME.cause, not in ME.message (earlier releases throw datamodelapi:datamodeltreeservice:callMethodError with no causes). Never call it bare:
try
isValid = validate(rrs);
catch ME
if ~ismember(ME.identifier, ["roadrunner:scenario:ValidationFailed" "datamodelapi:datamodeltreeservice:callMethodError"])
rethrow(ME); % genuine API/runtime error
end
if isempty(ME.cause)
fprintf(" %s\n", ME.message); % before R2026b Update 2: only the summary
end
for i = 1:numel(ME.cause)
fprintf(" %s\n", ME.cause{i}.message); % one diagnostic per cause
end
end
Fix each cause and re-validate until it returns true; when a fix isn't safe (e.g. a missing asset), ask the user. In a .xosc recreation, use the stand-in asset for a missing one instead and state the substitution (references/asset-catalog.md). Messages and fixes: references/validation-diagnostics.md. validate(rrs, ShowWarnings=true) also surfaces non-blocking diagnostics.
Write the final build code to a .m script in the working folder and run it from there, so the user can rerun and review it. Then summarize what was built — never simulate unless explicitly asked — and label every timing, gap or collision outcome you state as calculated, not simulated (only a simulation confirms it). Save only when asked or given a name: saveScenario(rrApp, "Name") writes <project>/Scenarios/Name.rrscenario and silently overwrites, so check isfile first and report the path from status(rrApp).Scenario.Filename. A scene created with newScene or a road import has no file yet, and saveScenario fails ("Scene has no file path") until you save it with saveScene(rrApp, "Name"); check isfile for the scene too.
| User asks to... | Invoke | Entry point |
|---|---|---|
| "Simulate" / "Run it" / "Log trajectories" | roadrunner-simulate-scenario skill | createSimulation(rrApp) |
| "Export to OpenSCENARIO" | API directly | exportScenario(rrApp, "scenario.xosc", "OpenSCENARIO XML") |
Do NOT call simulation or log APIs yourself — invoke roadrunner-simulate-scenario.
Recreate a .xosc file as a RoadRunner scenario built with this skill. Follow references/openscenario-analysis.md for the full procedure; references/openscenario-mapping.md maps XOSC types to RoadRunner types.
Critical rules (full text in the reference):
<LogicFile>.RelativeTargetSpeed delta=-8 → SpeedReference="actor", Direction="slower", Speed=8).Step 1 — Analyze (no MATLAB code yet): validate the XML; resolve parameters, expressions, and CatalogReferences; translate Init positions to world [x, y, z] with scripts/xoscPositionToWorld.p (pass position values as numbers — wrap each XML attribute in str2double(); roadId also works as text, but laneId, s, t or offset as text error or silently give a position tens of metres off); describe Story intent and serial/parallel topology. Fill in the Scenario Description (assets/scenario-description-template.md) and wait for user approval.
Step 2 — Build: do Workflow step 2's unsaved-work check first (newScene also discards an unsaved scenario); then newScene(rrApp), import the .xodr with openDriveImportOptions ProjectionMode="noprojection", newScenario(rrApp), and create the handles from Workflow step 2 (rrApi, rrs, phaseLogic, rrprj) without its openScene/newScenario, which would replace the imported road. Then run Workflow steps 3–8 using the approved description as the plan. Anchoring: lane-following actors autoAnchor, including on junction connector roads; path-following actors and their route waypoints are NOT autoAnchored; MiscObjects (props) are NOT autoAnchored — anchoring discards the source's lateral offset. To keep a source lane offset on a lane-following actor, autoAnchor it first, then set actor.InitialPoint.LateralOffset = -offset (source +0.5 → −0.5); set before autoAnchor, it is lost and can move the actor.
Key mappings: anchored actors align with the lane; unanchored actors (MiscObjects, path-following actors) keep the default 90° heading unless you set the source heading with setActorWorldAnglesDegrees(actor.InitialPoint, rad2deg(h), 0, 0); FollowTrajectoryAction/AssignRouteAction are supported only when their trigger chain resolves to t=0; AddEntityAction actors get a WaitAction in a SystemActionPhase as their first phase, with speed set on the following phase; actors with ChangeLaneAction or ChangeLateralOffsetAction must be lane-following (no route).
newScenario() creates a root fail condition (CollisionCondition: any actor-to-actor collision fails) and a root end condition (SimulationTimeCondition, 60 s). Edit them in place; never add duplicates:
rootPhase = phaseLogic.RootPhase;
failCond = rootPhase.FailCondition; % setFailCondition would replace it and drop any actor pair
failCond.FirstActor = ego; % fail only on this pair (verified in R2026b simulation)
failCond.SecondActor = truck;
rootEndCond = setEndCondition(rootPhase, "SimulationTimeCondition");
rootEndCond.Time = 30;
Collision analysis (rrs.CollisionUtility + roadrunner.extensions.setupCollision(rrApp, rrApi, rrSim)) inserts Wait actions so actors meet at chosen collision points; it needs intersecting routes (no lane-following) and at most 2 phases per actor. Before ever calling setupCollision: run the geometry pre-check in references/collision-utility.md — rear-end and head-on are not supported, so time those with the bumper-gap calculation and tell the user — and check that matlabshared.supportpkg.getInstalled lists the Euro NCAP Test Suite (without it the call opens an installer).
.Actor on ActorActionPhase and condition objects.phase.Actions(1) instead.autoAnchor requires proximity — within 5 m of the road surface.Rule is "le" or "ge" only.setEndCondition, not addEndCondition — one end condition per phase.ChangeLaneAction and ChangeLateralOffsetAction need lane-following mode — no routes on those actors.LaneOffset can land on junction connectors — put lane-change actors on HD-map parallel lanes with autoAnchor.WorldPosition is read-only after anchoring; rebuild with newScenario().autoAnchor jumps lanes at lane-piece ends — use fractions 0.2–0.8 of a piece (also along chained pieces), check each shift (> 0.5 m = wrong lane) and that no two actors overlap; validate() does not catch overlaps. Never probe positions by moving an anchored point and re-calling autoAnchor in a loop — it freezes RoadRunner R2026b within a few calls; query the HD map instead.setEndCondition(phase, "Type").Prop = N — MATLAB errors on every phase type (it can't assign into a function result). Use c = setEndCondition(phase, "Type"); c.Prop = N; (the dot form phase.setEndCondition("Type").Prop = N also works).ActorActionPhase. Concurrent actions: first phase in serial, the others via addPhaseInParallel(phaseLogic, firstPhase, "ActorActionPhase"). They must control different axes: two lateral or two longitudinal actions at once silently drop one — run those in serial.addPhaseInParallel on a "ParallelPhase" you created — it adds siblings next to it, leaving it empty, and it can't be removed. Prefer #27 (the API adds the wrapper); fill a container you created with its own addPhase(container, "ActorActionPhase").DynamicsShape = "sinusoidal" validates but breaks simulation — use "cubic" (closest S-curve) and tell the user.Full list (#6–7, #13, #15–17, #20–25, #28–36), violation outcomes and recovery: references/common-mistakes.md. Key functions, frequent wrong property names and movement modes: references/api-quick-reference.md.
[X Y Z]..fbx/.rrchar where disk shows .fbx_rrx/.rrchar_rrx.status(rrApp).Scene.Filename); if none is open, use ScenarioBasic.rrscene (339 short HD-map driving lane pieces, only 35 ≥ 30 m; ScenarioStart anchor). Say which scene you used. Intersections: FourWaySignal, FourWayStop, T_Intersection (references/scene-awareness.md)."Ego", "TargetVehicle", "Pedestrian1").Helpers in scripts/ (on the path from Step 1); table and usage example in references/helper-scripts.md:
helperSceneAwareness — HD map, lane survey, road features and placement recommendations. Multi-level scenes: RoadFeature="bridge" (or "ground", "ramp", "overpass"), then FilterLaneIDs=sceneInfo.FilteredLaneIDs in actorSpecs.helperPlaceActors — batch place, anchor, set speed and verify (returns a cell array).helperGetPositionFromHDMap, helperSurveyLanes — positions along lanes; lane filtering.helperCheckScenarioStructure — flags silent structural mistakes; run before validate.xoscPositionToWorld.p — .xosc positions to world coordinates (position values as numbers; roadId may be text).references/actions-and-conditions.md — all actions and conditions, properties, valid valuesreferences/routes-and-points.md — points, route segments, time-based and airborne pathsreferences/physics-first-design.md — derive speeds, gaps and timing before codingreferences/validation-diagnostics.md — validate() contract, messages and fixesreferences/common-mistakes.md — full constraint list, wrong names, recovery patternsreferences/api-quick-reference.md — key functions, frequent wrong names, movement modesreferences/helper-scripts.md — helper table and usage patternreferences/scene-awareness.md — scene catalog and manual HD Map queriesreferences/lane-connectivity.md — lane network, road features, connected pathsreferences/asset-catalog.md — vehicle, character and prop paths; stand-in vehiclesreferences/collision-utility.md — collision analysis setup and limitsreferences/behaviors-and-parameters.md — behavior assets, and what the API cannot doassets/scenario-templates.md — tested cut-in, crossing, lead-follow, emergency-brake patternsassets/scenario-description-template.md — fillable Scenario Description for .xosc recreationsreferences/openscenario-analysis.md, references/openscenario-mapping.md — .xosc procedure and type mappingCopyright 2026 The MathWorks, Inc.
assets/scenario-description-template.md (opens in a new tab)assets/scenario-templates.md (opens in a new tab)manifest.yaml (opens in a new tab)references/actions-and-conditions.md (opens in a new tab)references/api-quick-reference.md (opens in a new tab)references/asset-catalog.md (opens in a new tab)references/behaviors-and-parameters.md (opens in a new tab)references/collision-utility.md (opens in a new tab)references/common-mistakes.md (opens in a new tab)references/helper-scripts.md (opens in a new tab)references/lane-connectivity.md (opens in a new tab)references/openscenario-analysis.md (opens in a new tab)references/openscenario-mapping.md (opens in a new tab)references/physics-first-design.md (opens in a new tab)references/routes-and-points.md (opens in a new tab)references/scene-awareness.md (opens in a new tab)references/validation-diagnostics.md (opens in a new tab)scripts/helperAnalyzeHDMapLanes.m (opens in a new tab)scripts/helperCheckScenarioStructure.m (opens in a new tab)scripts/helperClassifyRoadFeatures.m (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/automotive:roadrunner-author-scenariofrom automotive
npx claudepluginhub matlab/matlab-agentic-toolkit --plugin automotive9 skills in this plugin
/matlab-cosimulate-sumo-simulinkBuild Simulink models that co-simulate with Eclipse SUMO traffic simulator. Use when creating SUMO-Simulink co-simulation, traffic simulation, TraCI connection, vehicle-in-the-loop testing, or ADAS scenario validation with SUMO. Covers Server/Client setup, Reader/Writer/Actor block configuration, random traffic generation, ego vehicle control, and SUMO file creation. Also use when the user mentions SumoInterfaceLibrary, .sumocfg files, or wants to connect Simulink to an external traffic simulator.
/matlab-fit-tire-modelFit a tire model (Magic Formula 6.2/5.2/5.1, Dugoff, or Fiala) to measured tire force and moment data using the Vehicle Dynamics Blockset Extended Tire Features API (tireData.import, tireModel.new, tireModel.fit, tireModel.export). Use when fitting, parameterizing, or calibrating a tire model from tire measurement data (TYDEX, Calspan, MTS, or text/CSV from any test source), creating a .tir file, or building a Magic Formula tire model from test data. Also use for the individual steps: importing TYDEX, Calspan, MTS, or CSV tire data (file extensions `.tdx` for TYDEX; `.data`, `.tim`, `.rsp` for MTS; any other extension read as text) into a tireData object, exporting a tire model to .tir, inspecting, smoothing, cropping, or plotting tire measurement data or a model's response, or converting a fitted model to another type.
/matlab-import-driving-dataImport recorded driving sensor data (GPS, camera, lidar, actor tracks, lanes) into scenariobuilder.* objects (GPSData, CameraData, LidarData, ActorTrackData, Trajectory, laneData) and run preprocessing — synchronize, offset correction, crop, normalizeTimestamps, convertTimestamps. Also: compute actor tracks from lidar when no annotations exist, attach camera/lidar mounting + intrinsics, export to MAT/workspace/timetable/script. Use for raw driving dataset files (KITTI, nuScenes, Waymo, Pandaset, ROS/ROS2 bags, .mat, .csv, .mp4) or driving/vehicle/sensor logs that need wrapping. drivingLogAnalyzer (DLA) is OPT-IN ONLY — invoke only on explicit user request ('DLA', 'open in DLA', 'inspect/explore/analyze the recording') or reported sensor problem (sync drift, timestamp mismatch, overlay misalignment). NEVER auto-launch DLA after wrapping (Rule 0). For 'build scenario / export to RoadRunner / drivingScenario / OpenSCENARIO / Unreal / simulate', hand off to matlab-use-scenario-builder./matlab-use-ncap-protocolGenerate Euro NCAP test scenarios and variants using the ADT Euro NCAP support package. Use when creating NCAP seed scenarios, generating variants, translating between drivingScenario and RoadRunner, plotting scenario descriptors, computing NCAP scores, or exporting reports. Triggers on: ncapScenario, euroAssessment, getScenario, getScenarioDescriptor, generateVariants, ScenarioDescriptor, ScenarioDescriptorPlot, ncapScore, ncapReport, exportReport, configureVUT, assessmentTable, Euro NCAP, CCRs, CCRm, CCRb, CCFtap, CCCscp, CPNA, CPFA, CBNA, variant generation.
/matlab-use-scenario-builderGenerate driving scenes, scenarios, road surfaces, and 3D content from scenariobuilder.* sensor data (GPS, camera, lidar, actor tracks) using Scenario Builder for Automated Driving Toolbox. BUILD, EXPORT, or AUGMENT a virtual scenario/scene/map: ego or actor trajectories, trajectory smoothing, OpenCRG road-surface extraction, 3D asset generation, static-object placement, point-cloud georeferencing + elevation, lane-based ego localization, sensor-fusion tracking, scenario-event extraction (cut-ins, hard brakes, near-misses, ADAS disengagements), or export to RoadRunner, drivingScenario, OpenDRIVE, OpenCRG, OpenSCENARIO, or Unreal Engine. Also: log-to-scenario, scenario harvesting, accident/near-miss reconstruction, SOTIF (ISO 21448) and ISO 26262 scenario coverage, USGS-aerial-lidar augmentation, traffic-sign placement, vision-based vehicle classification for actor assets. NOT for raw-data import or multi-sensor sync/crop/offset/timestamp normalization — route those to matlab-import-driving-data./roadrunner-build-rrhd-mapBuild, convert, and import RoadRunner HD Maps (.rrhd) in MATLAB. Author lanes, lane boundaries, markings, junctions, signs, barriers, and speed limits with roadrunnerHDMap; convert Lanelet2 (.osm, Autoware) maps to RRHD; resolve RoadRunner road asset paths for markings, crosswalks, signs, signals, and barriers; and import or build .rrhd or OpenDRIVE (.xodr) files into a RoadRunner scene. Use when creating road networks for driving simulation, converting Lanelet2 or other HD map sources to RRHD, looking up road asset paths, or loading and verifying a map in RoadRunner or RoadRunner Scene Builder. Not for building scenes from recorded sensor data, running simulations, or recreating OpenSCENARIO (.xosc) scenarios.
Other plugins' skills for the same job