roadrunner-import-scene
The roadrunner-import-scene skill connects to a running RoadRunner application instance or auto-launches one, then imports map files (RRHD or OpenDRIVE formats) into a new scene for visualization and verification. Use this skill when importing converted maps or validating map content after Lanelet2-to-RRHD conversion, provided RoadRunner is installed and a project folder exists.
git clone --depth 1 https://github.com/matlab/matlab-agentic-toolkit /tmp/roadrunner-import-scene && cp -r /tmp/roadrunner-import-scene/skills-catalog/automotive/roadrunner-import-scene ~/.claude/skills/roadrunner-import-sceneSKILL.md
# RoadRunner Scene Import
Connect to a running RoadRunner application and import map files into a new scene for visualization and verification.
## When to Use
- Importing a `.rrhd` file into RoadRunner for visual verification
- Importing an OpenDRIVE `.xodr` file into RoadRunner
- Connecting to a running RoadRunner instance from MATLAB
- Auto-launching RoadRunner when no instance is running
- Verifying converted maps after Lanelet2-to-RRHD or other conversions
## When NOT to Use
- Building RRHD map content — use `roadrunner-rrhd-authoring`
- Converting Lanelet2 to RRHD — use `roadrunner-convert-lanelet2-to-rrhd`
- Looking up asset paths — use `roadrunner-asset-mapping`
- RoadRunner is not installed or no valid project folder exists
## Key Rules
- **Always write to .m files.** Never put multi-line MATLAB code directly in `evaluate_matlab_code`. Write to a `.m` file, run with `run_matlab_file`, edit on error.
- **Only ONE RoadRunner instance per session.** Try `roadrunner.connect()` first; only launch if none exists.
- **Always copy file to project folder.** Use `status(rrApp).Project.Filename` and `copyfile()` explicitly in every import workflow — never omit or hide behind a variable.
- **Always set `bridgeOpts.IsEnabled = true` explicitly.** Never rely on constructor defaults for bridge auto-detection.
- **Run enforcement gates before `importScene`.** Connection, file location, and extension checks are mandatory.
- **Load before Build by default.** Use `ImportStep="Load"` unless user explicitly requests a full build.
## Prerequisites
- **RoadRunner** must be installed (R2025a or later) at a standard location under `C:/Program Files/`
- A **RoadRunner Project folder** must exist (the skill uses the Sample Project by default)
- If RoadRunner is already open, the skill reuses that instance
- If RoadRunner is NOT open, the skill **auto-launches it** — no manual steps required
## Connection Strategy
Always try `roadrunner.connect()` first to reuse an existing instance. **If no instance is running, launch one automatically** — never ask the user to open RoadRunner manually.
**IMPORTANT: Only ONE RoadRunner instance per session.** If the conversion pipeline already called `roadrunnerHDMap` (which may launch a background instance), retry `roadrunner.connect()` with a pause before launching a new one. Never call `roadrunner(InstallationFolder=...)` without first confirming no instance exists.
```matlab
% Try connecting (with retry for recently-launched instances)
rrApp = [];
for attempt = 1:3
try
rrApp = roadrunner.connect();
fprintf('Connected to existing RoadRunner instance.\n');
break;
catch
if attempt < 3
pause(2); % Wait for background instance to become ready
end
end
end
if isempty(rrApp)
% No instance running — find installation and launch
installPaths = { ...
"C:/Program Files/RoadRunner R2026a/bin/win64", ...
"C:/Program Files/RoadRunner R2025b/bin/win64", ...
"C:/Program Files/RoadRunner R2025a/bin/win64"};
installFolder = "";
for i = 1:numel(installPaths)
if isfolder(installPaths{i})
installFolder = installPaths{i};
break;
end
end
if installFolder == ""
error('RoadRunner:NotFound', ...
'No RoadRunner installation found under C:/Program Files/.');
end
% Launch ONE instance
rrApp = roadrunner(InstallationFolder=installFolder);
fprintf('Launched RoadRunner from %s\n', installFolder);
% Open or create a project (caller provides projectFolder, or use default)
if ~exist('projectFolder', 'var') || projectFolder == ""
projectFolder = fullfile(getenv("USERPROFILE"), "RoadRunner Projects", "ImportProject");
end
if isfolder(projectFolder)
openProject(rrApp, projectFolder);
else
newProject(rrApp, projectFolder);
end
fprintf('Project: %s\n', projectFolder);
end
```
### Connect with Custom Port
```matlab
rrApp = roadrunner.connect(apiPort); % default: 35707
rrApp = roadrunner.connect(apiPort, cosimPort); % default cosim: 35706
```
### Namespace Conflict Note
If you get `The class roadrunner has no Constant property or Static method 'hdmap'` after connecting, this means the `roadrunner` function is shadowed by the live `rrApp` variable. Clear and reinitialize:
```matlab
clear rrApp;
rrMap = roadrunnerHDMap; % reload namespace
rrApp = roadrunner.connect(); % reconnect
```
## Import Workflow
### Step 1: Create a Fresh Scene
Always create a new scene before importing to avoid stale data:
```matlab
newScene(rrApp);
```
### Step 2: Copy File to Project (MANDATORY — always show explicitly)
RoadRunner requires imported files to be inside the project folder. You MUST always include this exact pattern in your generated code — never assume the file is already there or hide it behind a variable:
```matlab
st = status(rrApp);
projectFolder = st.Project.Filename;
[~, fileName, ext] = fileparts(sourceFile);
destFile = fullfile(projectFolder, fileName + ext);
copyfile(sourceFile, destFile);
```
**NEVER** omit the `copyfile()` call or the `status(rrApp).Project.Filename` lookup. Even if you define a `destFile` variable elsewhere, you MUST show both the project path retrieval and the copy operation explicitly in every import workflow.
### Step 3: Import the Map
#### RoadRunner HD Map (.rrhd)
**Load only (inspect RRHD view before build):**
```matlab
importOpts = roadrunnerHDMapImportOptions;
importOpts.ImportStep = "Load";
importScene(rrApp, destFile, "RoadRunner HD Map", importOpts);
```
**Full import with build:**
```matlab
importOpts = roadrunnerHDMapImportOptions;
buildOpts = roadrunnerHDMapBuildOptions;
buildOpts.ClearSceneOfExistingData = true;
buildOpts.DetectAsphaltSurfaces = true;
bridgeOpts = autoDetectBridgesOptions;
bridgeOpts.IsEnabled = true; % MANDATORY: always set explicitly, never rely on default
buildOpts.AutoDetectBri>
Import 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-scenario-builder.
Generate driving scenes, scenarios, road surfaces, and 3D content from already-wrapped scenariobuilder.* sensor data (GPS, camera, lidar, actor tracks) using Scenario Builder for Automated Driving Toolbox. Use to 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 scene augmentation, traffic-sign placement from camera+lidar logs. NOT for raw-data import or multi-sensor sync/crop/offset/timestamp normalization — route those to matlab-driving-data-importer.
>
>
>
Build, modify, and diagram SimBiology models — API reference, helper functions, and layout patterns. Use when constructing or editing models programmatically or visually.
Fit SimBiology model parameters to data — fitproblem, population NLME, virtual patients, and NCA. Use when asked to fit, estimate, calibrate, or compute PK metrics.