roadrunner-scenario-simulating
Expert guidance for simulating RoadRunner scenarios via the MATLAB programmatic API and Simulink co-simulation. Use when the user wants to run a simulation, step through a simulation, control actors during co-simulation, add observers, attach sensors, retrieve simulation logs, or read/write scenario variables. Covers simulateScenario, createSimulation, ScenarioSimulation set/get, ActorSimulation getAttribute/setAttribute, addObserver, SensorSimulation, Simulink co-sim blocks, and publishActorBehavior. NOT for project setup, scene building, scenario authoring, or trajectory export.
npx skills add matlab/matlab-agentic-toolkit --skill roadrunner-scenario-simulating --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Provides expert instructions for simulating RoadRunner scenarios using the MATLAB programmatic API and Simulink co-simulation. It covers running full simulations, stepping frame-by-frame, external actor control, adding observers and sensors, retrieving logs, and reading/writing scenario variables. It specifically lists workflows for simple simulation, step-by-step control, reading actor state, MATLAB System object co-simulation, Simulink co-simulation, observers, sensor simulation, and scenario variables. It also enumerates supported workflows, required sequences, and how to start/monitor simulations.
How it works
- Workflow A describes running a pre-opened scenario with openScenario(rrApp, "MyScenario"); simulateScenario(rrApp, EnableLogging=true); and notes that simulateScenario does not return a log object.
- Workflow B details step-by-step simulation: obtain rrSim via createSimulation(rrApp); configure StepSize and MaxSimulationTime; start with simulateScenario(..., IsSteppingStart=true, IsBlocking=false, EnableLogging=true); then repeatedly set(rrSim, SimulationCommand="Step"); pause(stepSize); and finally stop and read SimulationLog with get(rrSim, "SimulationLog"). It also clarifies that Step is asynchronous and dot-method syntax must not be used.
- Workflow C shows reading actor state during a simulation with get(rrSim, "ActorSimulation"), selecting specific actors, and using getAttribute(actorSim, "AttrName") rather than dot properties. It lists runtime attributes and static attributes accessed via ActorModel and getAttribute.
- Workflow D explains co-simulation with MATLAB System Object: architecture, assigning behaviors (UI in 2024a, programmatic in 2025a+), using roadrunnerAPI(rrApp) to access Project and Scenario, retrieving assets with getAsset and createAsset, setting platform with setPlatform, and example System Object pattern including setupImpl and stepImpl with getAction, getAttribute, setAttribute, and sendEvent.
- Workflow E covers co-simulation with Simulink: placing RoadRunner Scenario block at model root, using RoadRunner Scenario Reader/Writer blocks, publishing actor behavior via Simulink.publish.publishActorBehavior, assigning behavior, and starting with set_param(model, SimulationCommand="start"). It notes bus types in rrScenarioSimTypes.mat and constraints.
- Workflow F describes Observers to monitor state without modification, requiring adding observers before start, and example observer class that reads attributes via getAttribute. It includes management functions addObserver, removeObserver, and querying with get(rrSim, "Observers").
- Workflow G outlines Sensor Simulation: creating Simulation object, getting SensorSimulation via get(rrSim, "SensorSimulation"), attaching sensors with addSensors, reading targets via targetPoses and laneBoundaries during stepping, and listing supported sensors.
- Scenario Variables explains getScenarioVariable, setScenarioVariable with string values, and getAllScenarioVariables returning an array of Name/Value pairs.
- Simulation Log shows how to access SimulationLog with get(rrSim, "SimulationLog"), querying Pose history with get(simLog, "Pose", "ActorID", id), extracting positions, and saving/loading logs with save and load on SimulationLog.
- Key Functions table is present but truncated in the excerpt; no new facts beyond what’s described above.
When to use it
Use when the user wants to run RoadRunner simulations, step through frames, externally control actors, observe state, add sensors, retrieve logs, or read/write scenario variables, including co-simulation with MATLAB System Objects or Simulink blocks.
What it can touch
- MATLAB APIs and objects: openScenario, simulateScenario, createSimulation, getAttribute, setAttribute, addObserver, removeObserver, get, set, pause, sleep, Simulink.ScenarioSimulation, ActorSimulation, SensorSimulation, ScenarioSimulation, SystemObject patterns, roadrunnerAPI, getAsset, createAsset, setPlatform, publishActorBehavior, set_param, start, Step, Replay, etc.
Caveats
- Distinct from drivingScenario (Automated Driving Toolbox); do not mix RoadRunner APIs with drivingScenario.
- Step-based workflows rely on asynchronous Step commands requiring pauses; improper sequencing can drop commands.
- Some features require specific MATLAB/Simulink versions (e.g., 2024a vs 2025a+ for programmatic behavior assignment).
- Logs are not returned by simple simulateScenario runs; use createSimulation for programmatic log access.
- Observers are read-only and must be added before starting simulations.
# RoadRunner Scenario Simulation Simulate RoadRunner scenarios, step through simulations, control actors in co-simulation, add observers, attach sensors, and retrieve results — from MATLAB and Simulink. ## When to Use - User wants to run a RoadRunner scenario simulation - User wants to step through a simulation frame-by-frame - User wants to control an actor externally (co-simulation) - User wants to observe simulation state (read-only monitoring) - User wants to add sensors and read target poses or lane boundaries - User wants to retrieve simulation logs programmatically - User wants to read or write scenario variables - User asks about co-simulation with Simulink - User asks about publishing actor behaviors ## When NOT to Use - Launching or connecting to RoadRunner - Authoring scenarios (adding actors, paths, behaviors in the editor) - Building or editing scenes (roads, terrain, assets) - Exporting actor trajectories to CSV — use `exportActorTrajectoryToCSV` directly - Working with `drivingScenario` (that is a DIFFERENT toolbox — Automated Driving Toolbox) ## Critical: Do NOT Confuse With drivingScenario `drivingScenario` (from Automated Driving Toolbox) is a MATLAB-native scenar
- When to Use
- When NOT to Use
- Critical: Do NOT Confuse With drivingScenario
- Decision Tree
- Workflow A: Simple Simulation (run to completion)
- Workflow B: Step-by-Step Simulation
- SimulationCommand values
- Polling SimulationStatus
- Workflow C: Reading Actor State
- Static Attributes (Name, BoundingBox, etc.)
- Workflow D: Co-Simulation with MATLAB System Object
- Architecture
- Assigning Behaviors
- System Object Pattern
What does the roadrunner-scenario-simulating skill do?
Expert guidance for simulating RoadRunner scenarios via the MATLAB programmatic API and Simulink co-simulation. Use when the user wants to run a simulation, step through a simulation, control actors during co-simulation, add observers, attach sensors, retrieve simulation logs, or read/write scenario variables. Covers simulateScenario, createSimulation, ScenarioSimulation set/get, ActorSimulation getAttribute/setAttribute, addObserver, SensorSimulation, Simulink co-sim blocks, and publishActorBehavior. NOT for project setup, scene building, scenario authoring, or trajectory export.
How do I install it?
Run `npx skills add matlab/matlab-agentic-toolkit --skill roadrunner-scenario-simulating --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From matlab/matlab-agentic-toolkit, a repository with 868 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
