$npx -y skills add matlab/matlab-agentic-toolkit --skill roadrunner-rrhd-authoringBuild RoadRunner HD Map entities in MATLAB — lanes, boundaries, markings, junctions, signs, signals, barriers, parking. Use when creating driving scenes from scratch, authoring road networks for simulation and testing automated driving systems, or assembling RRHD maps from Lanele
| 1 | # RRHD Authoring Skill |
| 2 | |
| 3 | Build RoadRunner HD Map (`.rrhd`) entities directly using the `roadrunnerHDMap` API in MATLAB. No external builder scripts required. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | - Building RRHD maps from scratch (synthetic scenes, test roads) |
| 8 | - Assembling RRHD entities from converted map data (Lanelet2, OpenDRIVE) |
| 9 | - Adding lanes, boundaries, markings, junctions, signs, barriers, or parking to an HD Map |
| 10 | - Need verified `roadrunner.hdmap.*` class/property reference and construction patterns |
| 11 | - Debugging RRHD construction errors (wrong property names, alignment issues) |
| 12 | |
| 13 | ## When NOT to Use |
| 14 | |
| 15 | - Converting Lanelet2 .osm files — use `roadrunner-convert-lanelet2-to-rrhd` (which invokes this skill) |
| 16 | - Looking up asset paths for markings/signs/barriers — use `roadrunner-asset-mapping` |
| 17 | - Importing finished .rrhd into RoadRunner — use `roadrunner-import-scene` |
| 18 | - Editing an existing RoadRunner scene interactively (this skill writes .rrhd files, not scene edits) |
| 19 | |
| 20 | ## Key Rules |
| 21 | |
| 22 | - **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. |
| 23 | - **Read references/apiReference.md** before writing any RRHD construction code. |
| 24 | - **Only build what the user asked for.** Do not add extra lanes, junctions, or objects unless explicitly requested. |
| 25 | - **`rrMap = roadrunnerHDMap;` must come first** — loads the namespace before any `roadrunner.hdmap.*` usage. |
| 26 | - **Create-then-assign pattern** — never pass constructor args (except `RelativeAssetPath` and `AlignedReference`). |
| 27 | - **Empty typed arrays** — use `ClassName.empty` not `[]`. |
| 28 | - **All geometry must be Nx3** — always include Z column (default 0 if flat). |
| 29 | - **Run enforcement gate before `write()`** — alignment, spatial, and geometry checks are mandatory. |
| 30 | |
| 31 | ## Critical API Rules |
| 32 | |
| 33 | **You MUST create a `roadrunnerHDMap` object before using any `roadrunner.hdmap.*` classes** (lazy namespace loading): |
| 34 | ```matlab |
| 35 | rrMap = roadrunnerHDMap; % REQUIRED — loads the namespace |
| 36 | ``` |
| 37 | |
| 38 | **Create-then-assign pattern** — never pass constructor args (except Name=Value for two classes): |
| 39 | ```matlab |
| 40 | ref = roadrunner.hdmap.Reference; |
| 41 | ref.ID = "myID"; % assign after creation |
| 42 | ``` |
| 43 | |
| 44 | **Name=Value constructors** — ONLY `RelativeAssetPath` and `AlignedReference` accept Name=Value: |
| 45 | ```matlab |
| 46 | rap = roadrunner.hdmap.RelativeAssetPath(AssetPath="Assets/Markings/StopLine.rrlms"); |
| 47 | ar = roadrunner.hdmap.AlignedReference(Reference=ref, Alignment="Forward"); |
| 48 | % WRONG: positional args error with "A name is expected" |
| 49 | ``` |
| 50 | |
| 51 | **Empty typed arrays** — never use `[]` for typed properties: |
| 52 | ```matlab |
| 53 | lane.Predecessors = roadrunner.hdmap.AlignedReference.empty; % CORRECT |
| 54 | lane.Predecessors = []; % WRONG: "Value must be of type AlignedReference" |
| 55 | ``` |
| 56 | |
| 57 | ## Verified Property Names (R2025a+) |
| 58 | |
| 59 | See [references/apiReference.md](references/apiReference.md) for the complete verified class/property table. Key gotchas: |
| 60 | |
| 61 | | Common Mistake | Correct | |
| 62 | |---|---| |
| 63 | | `LeftBoundary` | `LeftLaneBoundary` | |
| 64 | | `RightBoundary` | `RightLaneBoundary` | |
| 65 | | `Speed` | `Value` (int32) | |
| 66 | | `Unit = "KPH"` | `VelocityUnit = "Kph"` | |
| 67 | | `ParametricAttrib` | `ParametricAttribution` | |
| 68 | | `pa.Value = mr` | `pa.MarkingReference = mr` | |
| 69 | | `pa.StartFraction/EndFraction` | `pa.Span = [0 1]` (double array) | |
| 70 | | `JunctionPhase` | `Phase` | |
| 71 | | `roadrunnerHDMap("file.rrhd")` | `rrMap = roadrunnerHDMap; read(rrMap, "file.rrhd")` | |
| 72 | | Nx2 geometry | Nx3 geometry (always include Z column) | |
| 73 | | `cm.CurveMarkingTypeID` | `cm.MarkingTypeReference` | |
| 74 | | `b.BarrierTypeID` | `b.BarrierTypeReference` | |
| 75 | | `s.SignTypeID` | `s.SignTypeReference` | |
| 76 | | `s.BoundingBox` | `s.Geometry` (takes GeoOrientedBoundingBox) | |
| 77 | | `bb.Position` | `bb.Center` (1x3 double) | |
| 78 | | `bb.Orientation` | `bb.GeoOrientation` ([h,p,r] double array) | |
| 79 | | `pg.OuterRing` | `pg.ExteriorRing` (Nx3 double) | |
| 80 | | `bt.AssetPath` | `bt.ExtrusionPath` (for BarrierType only) | |
| 81 | | `roadrunner.hdmap.GeoOrientation` | NOT a class — use `[h,p,r]` double array directly | |
| 82 | | `Lane.Predecessors = []` | `Lane.Predecessors = roadrunner.hdmap.AlignedReference.empty` | |
| 83 | | `lb.ParametricAttributes = []` | Cannot clear — skip assignment for no markings | |
| 84 | | `RelativeAssetPath("path")` | `RelativeAssetPath(AssetPath="path")` — Name=Value required | |
| 85 | | `AlignedReference(ref, "Fwd")` | `AlignedReference(Reference=ref, Alignment="Forward")` | |
| 86 | | `Junction.Geometry = polygon` | `Junction.Geometry = multiPolygon` (wrap in MultiPolygon) | |
| 87 | | `MarkingReference.MarkingID = 5` | `MarkingReference.MarkingID = ref` (Reference object, NOT numeri |