Roadrunner Convert Lanelet2 To Rrhd 标志

Roadrunner Convert Lanelet2 To Rrhd

组织热门
matlab
roadrunner-convert-lanelet2-to-rrhd

使用 MATLAB 将 Lanelet2 地图(.osm)转换为 RoadRunner HD Map(.rrhd)格式。适用于将 Lanelet2 地图转换为 RoadRunner Scene Builder 场景、根据开源地图数据构建驾驶场景,或转换用于仿真的道路网络定义。

Add to TypingMind

概览

发布者matlab
代码仓库matlab-agentic-toolkit
技能名称roadrunner-convert-lanelet2-to-rrhd
星标数
1.2K
复刻数
138
附带文件
21
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 21 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 matlab 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Roadrunner Convert Lanelet2 To Rrhd AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/automotive/roadrunner-convert-lanelet2-to-rrhd
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/matlab/matlab-agentic-toolkit.git /tmp/matlab-agentic-toolkit
mkdir -p .claude/skills
cp -r /tmp/matlab-agentic-toolkit/skills-catalog/automotive/roadrunner-convert-lanelet2-to-rrhd .claude/skills/roadrunner-convert-lanelet2-to-rrhd
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Roadrunner Convert Lanelet2 To Rrhd,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Roadrunner Convert Lanelet2 To Rrhd。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Roadrunner Convert Lanelet2 To Rrhd 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Lanelet2 to RRHD Converter

Converts Lanelet2 .osm files to RoadRunner HD Map .rrhd format.

When to Use

  • Converting a Lanelet2 .osm file to RoadRunner HD Map .rrhd format
  • Importing Lanelet2 maps into RoadRunner via MATLAB
  • Building RRHD from .osm sources that contain type=lanelet relations
  • Need full pipeline: parse, geometry, topology, semantics, junctions, barriers, signs, markings

When NOT to Use

  • Input is a standard OpenStreetMap file (highway=* ways without type=lanelet relations)
  • Input is OpenDRIVE .xodr — import directly via roadrunner-import-scene
  • Building RRHD from scratch without a source file — use roadrunner-rrhd-authoring
  • Only need asset path lookups — use roadrunner-asset-mapping

Key Rules

  • Always write to .m files when executing code. Never put multi-line MATLAB code directly in evaluate_matlab_code. Write to a .m file, run with run_matlab_file, edit on error. Exception: if the user asks to "show the pattern" or says "do not execute", show code inline without writing files.
  • ALL pipeline steps are mandatory. Do NOT stop after writing lanes/boundaries — junctions, curve markings, barriers, signs, and speed limits must all be built.
  • Boundary geometry is IMMUTABLE. Never flip, resample, project, or modify boundary points.
  • One boundary object per way. Deduplicate via wayToBndID map.
  • Detect alignment for EVERY lane. Never hardcode "Forward" for all boundaries.
  • Center line density: 1 point per meter minimum. Use max(10, round(avgLen), nLeft, nRight).
  • Run enforcement gate before write(). Alignment, spatial, extension, and completeness checks are mandatory.
  • No nested function definitions. Code runs in script context — all logic inline or anonymous functions.

Behavior

Generate MATLAB code that performs the conversion pipeline described below. Run it via mcp__matlab__evaluate_matlab_code. No pre-built scripts or addpath calls are needed — Claude generates all code at runtime from these instructions.

MANDATORY: ALL steps must be executed. Do NOT stop after writing lanes/boundaries. The pipeline is incomplete without: junctions, curve markings (stop lines + crosswalks), barriers, signs, and speed limits. Every element found in the OSM MUST appear in the output RRHD.

MANDATORY: Steps 3b and 3c (discovery) must execute IN THE SAME code block as Step 3a. These are not optional post-processing — they are part of parsing. The discovery loop code is inlined below in Step 3. If you skip 3b/3c, the completeness gate in Step 9 will fail with assertion errors.

Scope: This skill supports Lanelet2 OSM only. If the input is a standard OpenStreetMap file (highway=* ways without type=lanelet relations), do NOT attempt conversion. Instead inform the user: "This file appears to be a standard OpenStreetMap road network, not a Lanelet2 map. This skill only supports Lanelet2 OSM → RRHD conversion."

Companion skills (invoke automatically during conversion):

SkillWhen to invokePurpose
roadrunner-rrhd-authoringStep 9 (Build RRHD Objects)Provides roadrunner.hdmap.* class/property reference and construction patterns
roadrunner-asset-mappingStep 8 (Extract Semantics)Resolves marking subtypes, sign codes, and barrier types to RoadRunner asset paths

These skills are loaded on demand — read their references when generating RRHD construction code or resolving asset paths.

Skill boundary: This skill owns everything Lanelet2-specific (OSM parsing, node-ref topology, turn_direction clustering, opposing-boundary detection). For RRHD object construction patterns (alignment algorithm, center line synthesis, junction polygon, API reference), defer to roadrunner-rrhd-authoring.

Coordinate System

Lanelet2 OSM nodes may use either:

  • local_x/local_y tags — already in local meters, use directly as geometry X/Y
  • lat/lon attributes only — geographic coordinates that MUST be projected to local meters

Step 1: Check for map_projector_info.yaml

Lanelet2 datasets typically include a map_projector_info.yaml file in the same directory as the .osm file. This file specifies the projection and map origin:

yaml
ProjectorType: TransverseMercator
VerticalDatum: WGS84
MapOrigin:
  Latitude: 42.300945
  Longitude: -83.698205
  Altitude: 0

Always look for this file first. Parse it to get ProjectorType and MapOrigin:

matlab
projFile = fullfile(fileparts(osmFile), "map_projector_info.yaml");
if isfile(projFile)
    txt = fileread(projFile);
    latMatch = regexp(txt, 'Latitude:\s*([-\d.]+)', 'tokens');
    lonMatch = regexp(txt, 'Longitude:\s*([-\d.]+)', 'tokens');
    if ~isempty(latMatch) && ~isempty(lonMatch)
        originLat = str2double(latMatch{1}{1});
        originLon = str2double(lonMatch{1}{1});
    end
end

If MapOrigin is [0, 0], the origin is implicit — use the centroid of all nodes instead.

Step 2: Determine coordinate mode

  1. Nodes have local_x/local_y → use directly, set geoRef from map_projector_info.yaml MapOrigin (or from node lat/lon if yaml missing)
  2. Nodes have only lat/lon → project to local ENU meters using the origin from yaml (or node centroid as fallback)

Step 3: Project lat/lon to local meters (when needed)

matlab
% Origin from map_projector_info.yaml or centroid fallback
geoRef = [originLat, originLon];

% For each node, convert to local meters:
dLat = node.lat - originLat;
dLon = node.lon - originLon;
metersPerDegLat = 111132.92;
metersPerDegLon = 111132.92 * cosd(originLat);
x = dLon * metersPerDegLon;   % East
y = dLat * metersPerDegLat;   % North
z = node.ele;                  % Up (elevation)

Set rrMap.GeoReference = [originLat, originLon] so RoadRunner knows the map's geographic position.

IMPORTANT: This projection happens ONCE during node parsing. All downstream geometry (boundaries, center lines, barriers, signs) uses the projected local coordinates. The "boundary geometry is immutable" rule (below) refers to the projected coordinates — do not re-project or modify them after initial parsing.

Geometry Invariants (MUST enforce — violations produce broken RRHD)

These rules are NON-NEGOTIABLE. Every conversion MUST follow them:

  1. Boundary geometry is IMMUTABLE. Store way node coordinates (local or projected) exactly as computed during parsing. NEVER flip, resample, or modify boundary points after initial coordinate assignment. Shared boundaries between opposing lanes will corrupt if touched. Use Alignment="Backward" instead.

  2. One boundary object per way. Deduplicate via wayToBndID map. Multiple lanes reference the same boundary with different alignments.

  3. Alignment via left/right dot product + proximity test. Compute dp = dot(leftDir, rightDir) (normalized overall direction — this is correct for the threshold check). If dp >= -0.3: both boundaries are Forward. If dp < -0.3: boundaries are opposing — use proximity (d_ls_re = norm(leftStart - rightEnd) vs d_ls_rs = norm(leftStart - rightStart)) to determine which is Backward. If d_ls_re < d_ls_rs, right is Backward, left is Forward. (Note: the "NEVER use overall direction" warning in Step 9 applies to the multi-sample spatial verification step, not this dp threshold check.)

  4. Center line density: 1 point per meter minimum. Use nPts = max(10, round(avgBoundaryLength), nLeftPts, nRightPts). Too few points causes pchip interpolation deviation from true midpoint.

  5. Center line orthogonal endpoints only. Enforce perpendicular start/end on CENTER LINE via tangent blending. Do NOT project boundary endpoints.

MATLAB Script Constraints

Code runs in mcp__matlab__evaluate_matlab_code which is a script context (NOT a function file):

  • NO nested function definitions — all logic must be inline or use anonymous functions
  • NO function ... end blocks — these error with "Function definitions are not supported in this context"
  • Empty typed arrays — use ClassName.empty not [] (e.g., roadrunner.hdmap.AlignedReference.empty)
  • Name=Value constructors — RelativeAssetPath, AlignedReference require Name=Value syntax:
    matlab
    % CORRECT:
    rap = roadrunner.hdmap.RelativeAssetPath(AssetPath="Assets/Markings/StopLine.rrlms");
    ar = roadrunner.hdmap.AlignedReference(Reference=ref, Alignment="Forward");
    
    % WRONG (will error with "A name is expected"):
    rap = roadrunner.hdmap.RelativeAssetPath("Assets/Markings/StopLine.rrlms");
    ar = roadrunner.hdmap.AlignedReference(bndID, "Forward");
  • containers.Map empty assignment — never do map(key) = []. Use map(key) = zeros(1,0) or only assign non-empty values
  • No chaining ()() — geomMap(key)(:,1) errors with "Using parentheses directly after parentheses is disallowed". Assign to a temp variable first:
    matlab
    % WRONG: min(geomMap(k)(:,1))
    % CORRECT:
    pts = geomMap(k);
    minX = min(pts(:,1));
  • unique() on cell arrays — unique(cellArray) requires cellstr (cell of char vectors). For string arrays use unique(stringArray) directly. For mixed cells: unique(string(cellArray)).
  • containers.Map values need explicit type cast — values retrieved from containers.Map may lose their numeric type. Always cast before math: double(geoRef(1)) before passing to cosd(), sind(), etc.
  • Cell array struct field assignment — never do cellArray{end+1} = x; cellArray{end}.field = val; (errors with "dot indexing not supported for double"). Instead, build the struct first then append:
    matlab
    % WRONG:
    stopLineWays{end+1} = w; stopLineWays{end}.wayID = wid;
    % CORRECT:
    w.wayID = wid; stopLineWays{end+1} = w;
    % OR: store IDs in a separate parallel cell array

Pipeline (execute in order)

Step 1: Parse OSM

See references/readOSM.md and scripts/parseOSM.m.

matlab
doc = xmlread(osmFile);
% Parse nodes: id, lat, lon, ele, local_x, local_y (from tags)
% Parse ways: id, nodeRefs[], tags (containers.Map)
% Parse relations: id, members[], tags (containers.Map)

Step 2: Validate Format

Check that at least one relation has type=lanelet. If none found, error with clear message identifying the file as non-Lanelet2.

matlab
hasLanelet = false;
relKeys = relations.keys;
for i = 1:numel(relKeys)
    rel = relations(relKeys{i});
    if rel.tags.isKey('type') && strcmp(rel.tags('type'), 'lanelet')
        hasLanelet = true; break;
    end
end
if ~hasLanelet
    error('UNSUPPORTED FORMAT: This converter supports Lanelet2 OSM files only.');
end

Step 3: Extract Lanelets + Discover ALL Non-Lane Elements

This step has THREE mandatory sub-steps. ALL must execute.

Step 3a: Extract Lanelets

Filter relations with type=lanelet. See references/extractLanelets.md.

matlab
% For each relation with type=lanelet:
%   leftWayID  = member with role="left"
%   rightWayID = member with role="right"
%   subtype, one_way, speed_limit, turn_direction from tags
Step 3b: Discover ALL Way Types (MANDATORY — run immediately after 3a)

See scripts/discoverWayTypes.m for the reference implementation.

DO NOT use a whitelist. Scan every way, categorize by type tag using strsplit(wType, '/') for compound types:

matlab
stopLineWays = {}; pedestrianMarkingWays = {}; zebraMarkingWays = {};
bikeMarkingWays = {}; zigzagWays = {};
fenceWays = {}; guardRailWays = {}; jerseyBarrierWays = {};
wallWays = {}; curbstoneWays = {};
trafficSignWays = {}; trafficLightWays = {};
unmappedWays = containers.Map;

wayKeys = ways.keys;
for i = 1:numel(wayKeys)
    w = ways(wayKeys{i});
    if ~w.tags.isKey('type'), continue; end
    wType = w.tags('type');
    typeParts = strsplit(wType, '/');
    baseType = typeParts{1};
    switch baseType
        case 'stop_line', stopLineWays{end+1} = w;
        case 'pedestrian_marking', pedestrianMarkingWays{end+1} = w;
        case 'zebra_marking', zebraMarkingWays{end+1} = w;
        case 'bike_marking', bikeMarkingWays{end+1} = w;
        case {'zig-zag','zig_zag'}, zigzagWays{end+1} = w;
        case 'fence', fenceWays{end+1} = w;
        case 'guard_rail', guardRailWays{end+1} = w;
        case 'jersey_barrier', jerseyBarrierWays{end+1} = w;
        case 'wall', wallWays{end+1} = w;
        case 'curbstone', curbstoneWays{end+1} = w;
        case 'traffic_sign', trafficSignWays{end+1} = w;
        case 'traffic_light', trafficLightWays{end+1} = w;
        case {'line_thin','line_thick','virtual','road_border','rail','keepout','symbol'}
            % Lane boundary types — handled via lanelet extraction
        otherwise
            if unmappedWays.isKey(wType), unmappedWays(wType) = unmappedWays(wType)+1;
            else, unmappedWays(wType) = 1; end
    end
end
Step 3c: Discover ALL Relation Types (MANDATORY — run immediately after 3b)

See references/discoverRelations.md for the full categorization loop. Sorts all non-lanelet relations into: trafficSignRels, speedLimitRels, rightOfWayRels, trafficLightRels, multipolygonRels (struct with .building, .parking, .vegetation, .traffic_island, .walkway, .exit, .keepout), and unmappedRels (containers.Map with counts).

Print discovery summary and unmapped elements. Never silently drop anything.

Step 4: Build Geometry

Resolve way geometry from nodes. See references/extractGeometry.md for mandatory implementation patterns.

GeoReference auto-detection: If no local_x/local_y tags exist, compute centroid of all node lat/lon. Never use [0 0]. See references/detectGeoReference.md.

Priority: Use local_x/local_y node tags if available. Fall back to lat/lon → ENU (see references/latlon2enu.md):

matlab
east  = (lon - geoRef(2)) * 111320 * cosd(geoRef(1));
north = (lat - geoRef(1)) * 110540;

MANDATORY: Handle closed-loop boundaries BEFORE direction detection. If both boundaries are closed loops (start≈end gap < 1.0m), the overall direction vector is near-zero and dot(leftOverall, rightOverall) is unreliable (~0). This causes incorrect flips that produce center lines cutting across the track interior (e.g., 136m "width" instead of 6.5m). See roadrunner-rrhd-authoring skill's references/splitClosedGeometry.md for the full closed-loop boundary handling algorithm (local direction detection + start-point alignment).

MANDATORY center line synthesis pipeline — see roadrunner-rrhd-authoring skill's references/synthesizeCenterLine.md for the full algorithm with code. Summary:

  1. Detect opposing boundaries: Use closed-loop-aware detection (see splitClosedGeometry.md above)
  2. Resample to density-based point count using arc-length pchip — max(10, round(avgLen), nLeft, nRight)
  3. Average resampled boundaries for center line
  4. Enforce orthogonal endpoints with 50% tangent blending (skip for closed-loop lanes)
  5. Do NOT modify boundary geometry — use Alignment property instead

CRITICAL: Do NOT apply orthogonal endpoint projection to boundary geometry. Boundaries are shared between multiple lanes (including opposing-direction lanes). Modifying a shared boundary's endpoints to match one lane's center line direction will corrupt it for other lanes referencing the same boundary. The Alignment property handles the direction relationship.

Boundary geometry rule: Always store the ORIGINAL way geometry from OSM nodes. Compute alignment using the robust multi-sample algorithm (see roadrunner-rrhd-authoring/references/alignmentRules.md). Do NOT use a simple dot product of overall directions — this fails on curved geometry.

All geometry must be Nx3 (include Z from ele tag, default 0).

Step 5: Split Closed Roads

RoadRunner cannot render self-closed geometry. See references/splitClosedRoads.md and roadrunner-rrhd-authoring skill's references/splitClosedGeometry.md for the generic N-way orthogonal split algorithm.

Split using perpendicular cross-section projection at ALL joints (including closure). Use roadrunner-rrhd-authoring/references/orthogonalSplit.md for the full N-way algorithm.

Step 6: Extract Topology

Use boundary endpoint node matching as primary method, with geometry proximity (1.0m threshold) as fallback. See references/extractTopology.md.

Critical rules:

  • Account for opposing boundary directions when matching nodes (use dp threshold of -0.3, proximity test for backward-right lanes)
  • Apply opposing-direction filter using EFFECTIVE travel direction (reverse raw direction for backward-right lanes)
  • Apply left-gap filtering to remove false successors where left boundary gap > 3m when a better alternative exists

Step 7: Detect Junctions

See references/extractJunctions.md for the full algorithm with code.

Primary method: Use turn_direction tag (straight, left, right) as the junction lane indicator. Fallback: Lane is junction if (predecessor has >1 successors) OR (successor has >1 predecessors).

Critical rules:

  • BFS clustering with 8m threshold — NOT union-find (causes transitive chaining across distant intersections). Post-filter: verify each member is within 12m of cluster centroid.
  • boundary(pts,0.7) for polygon shape — produces good curved polygons. Use convhull selectively for junctions where boundary() concavity excludes lanes.
  • Min 2 lanes per cluster (catches small T-intersections that 3-lane threshold misses)
  • Fallback: uncovered fan-in/fan-out nodes — after primary clustering, detect nodes with >=2 lanes ending AND >=2 lanes starting but no junction coverage. Add junction from turn_direction lanes at those nodes.
  • Add non-turn lanes to existing junctions when they pass through junction topology nodes (improves polygon coverage)
  • Strip markings from all junction lane boundaries (don't assign ParametricAttributes)
  • Graceful fallback: If detection is unreliable, skip junctions entirely — use UseLaneGroups=true in build options during import

Step 8: Extract Semantics

See references/extractSemantics.md.

Lanelet2 boundary subtypeRRHD Marking IDAsset Path
solidSolidWhiteAssets/Markings/SolidSingleWhite.rrlms
dashedDashedWhiteAssets/Markings/DashedSingleWhite.rrlms
solid_solidSolidDoubleYellowAssets/Markings/SolidDoubleYellow.rrlms
dashed_solidDashedSolidYellowAssets/Markings/DashedSolidYellow.rrlms
solid_dashedDashedSolidYellowAssets/Markings/DashedSolidYellow.rrlms (+ FlipLaterally=true)
Lanelet2 subtypeRRHD LaneType
road, highway, bus_laneDriving
crosswalk, walkwayCurveMarking (NOT a lane)
bicycle_laneBiking
emergency_laneShoulder
parkingParking

Travel direction:

  • turn_direction tag present → "Forward" (always unidirectional)
  • one_way=yes → "Forward"
  • Sidewalk/Curb → "Undirected"
  • Otherwise → "Bidirectional"

Step 8b: Filter Crosswalks/Walkways from Lane List

BEFORE building RRHD lane objects, separate lanelets by subtype:

  • subtype=crosswalk or subtype=walkway → route to CurveMarkings (use center line as geometry, type = SimpleCrosswalk)
  • All other subtypes → build as RRHD Lanes

Never create a Lane object for crosswalk/walkway lanelets. They become CurveMarking instances.

CurveMarkingType extensions — do NOT confuse:

  • Stop lines → .rrlms (lane marking style): Assets/Markings/StopLine.rrlms
  • Crosswalks → .rrcws (crosswalk style): Assets/Markings/SimpleCrosswalk.rrcws

Using .rrcws for stop lines causes "Asset file is missing" on import.

Step 9: Build RRHD Objects

See references/buildRRHD.md for complete construction patterns.

Critical rules:

  • rrMap = roadrunnerHDMap; must come first (loads namespace). WARNING: On some systems, roadrunnerHDMap may launch a background RoadRunner instance. The import skill's connection logic handles this with retry — see roadrunner-import-scene. Do NOT call roadrunner(InstallationFolder=...) separately if roadrunnerHDMap already launched one.
  • Create-then-assign pattern for all roadrunner.hdmap.* objects
  • Strip markings from junction lane boundaries (simply don't assign ParametricAttributes)
  • NEVER modify boundary geometry — store original OSM way node coordinates exactly as-is. Boundaries are shared between multiple lanes (including opposing-direction lanes). Any modification (flipping, endpoint projection, resampling) will corrupt the boundary for other lanes.
  • One boundary per way — use wayToBndID map to deduplicate. First lanelet to reference a way creates the boundary; all others share it via alignment.
  • Detect boundary alignment FOR EVERY LANE using the robust multi-sample algorithm in roadrunner-rrhd-authoring skill's references/alignmentRules.md. NEVER hardcode alignment = "Forward" for all boundaries — this is the #1 cause of bad scenes. NEVER use overall direction (geom(end,:)-geom(1,:)) for spatial verification — it fails on highly curved segments (e.g., split half-ovals where the chord direction doesn't represent travel direction). The algorithm has two steps: (1) proximity-based direction detection, (2) multi-sample local-tangent spatial verification with majority vote.

Verified property names: See roadrunner-rrhd-authoring skill's references/apiReference.md for the complete class/property table. Key non-obvious mappings: CurveMarking.MarkingTypeReference (not CurveMarkingTypeID), Barrier.BarrierTypeReference (not BarrierTypeID), Sign.Geometry (GeoOrientedBoundingBox, not BoundingBox), SpeedLimit.Value + .VelocityUnit="Kph", ParametricAttribution.Span=[0 1] (not StartFraction/EndFraction), MarkingReference.MarkingID takes a Reference object (not numeric).

Critical: Filter self-referencing topology (lane predecessor/successor pointing to itself) before writing — RoadRunner will error with "connectedLane.Object != this" on import.

Step 10: Post-Processing (MANDATORY — do NOT skip)

Snap connected endpoints — successor start must match predecessor end (lane + boundaries). For each pred→succ pair with gap < 1.0m, snap succ start to pred end. See references/snapEndpoints.md and roadrunner-rrhd-authoring skill's scripts/snapConnectedEndpoints.m.

Height conflict resolution (MANDATORY): Overlapping unconnected lanes at same Z cause grass artifacts. Bump narrower lane by +0.05m per Z-level using graph coloring. See roadrunner-rrhd-authoring skill's scripts/resolveHeightConflicts.m.

Boundary deduplication (MANDATORY): Opposing lanes in Lanelet2 reference different way IDs that may contain the same geometry reversed. The per-way wayToBndID deduplication only catches same-way reuse — geometry-based deduplication catches reversed duplicates. See roadrunner-rrhd-authoring skill's references/deduplicateBoundaries.md for the algorithm.

Step 11: Assemble & Write

Assign all arrays to rrMap (Lanes, LaneBoundaries, LaneMarkings, SpeedLimits, Junctions, CurveMarkingTypes, CurveMarkings, BarrierTypes, Barriers, SignTypes, Signs) and set rrMap.GeoReference = geoRef (1x2 [lat, lon]). Call write(rrMap, outputFile). See references/buildRRHD.md.

Junctions are optional: If junction detection was skipped, omit rrMap.Junctions — defaults to empty. Use UseLaneGroups=true in build options during import.

Step 9 Sub-Steps — Build ALL Non-Lane RRHD Objects

Step 9 MUST build ALL non-lane elements from Steps 3b/3c. See references/extractNonLaneElements.md for code patterns. Sub-steps: 9a CurveMarkings (stop lines, crosswalks, bike markings), 9b Barriers (fence, guard rail, jersey barrier, wall, curbstone), 9c Signs (from ways AND relations — see references/signCodeMapping.md and references/mapLanelet2SignCode.md for sign type resolution), 9d SpeedLimits, 9e Placed Objects (see references/placedObjects.md for custom relation parsing).

Enforcement Gate (MANDATORY — run before write())

You MUST execute the validation block in references/enforcementGate.md. It catches the three most common conversion errors (alignment, spatial correctness, asset extensions, completeness). Do NOT skip or simplify it.

After Write

Print unmapped element counts (buildings, vegetation, signals — not importable). Then use roadrunner-import-scene skill to import. See references/importIntoRoadRunner.md for build options.

Key Functions

FunctionPurpose
xmlread(osmFile)Parse OSM XML into DOM document
roadrunnerHDMapCreate HD Map object (loads namespace)
write(rrMap, file)Write HD Map to .rrhd file
containers.MapStore parsed nodes, ways, relations
pchip / interp1Arc-length resampling for center lines
vecnormDistance computations for clustering and proximity
strsplitParse compound type tags (type/subtype)

Conventions

  • Store original OSM way node coordinates exactly as parsed — never modify boundary geometry
  • Use containers.Map for all indexed lookups (nodes, ways, relations, geometry)
  • All geometry is Nx3 with Z from ele tag (default 0)
  • Use proximity-based BFS clustering for junctions (8m threshold + 12m centroid filter), never union-find
  • Use boundary(pts,0.7) for junction polygons; convhull selectively for small junctions needing full coverage
  • Print discovery summary after parsing — never silently drop unmapped elements
  • Use tiledlayout/nexttile for multi-panel figures (not subplot)

Copyright 2026 The MathWorks, Inc.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Roadrunner Convert Lanelet2 To Rrhd AI 技能有什么作用?

使用 MATLAB 将 Lanelet2 地图(.osm)转换为 RoadRunner HD Map(.rrhd)格式。适用于将 Lanelet2 地图转换为 RoadRunner Scene Builder 场景、根据开源地图数据构建驾驶场景,或转换用于仿真的道路网络定义。

为什么在 TypingMind 中使用 Roadrunner Convert Lanelet2 To Rrhd?

因为您只需安装一次,就能搭配任何模型使用。Roadrunner Convert Lanelet2 To Rrhd 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Roadrunner Convert Lanelet2 To Rrhd?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/automotive/roadrunner-convert-lanelet2-to-rrhd。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Roadrunner Convert Lanelet2 To Rrhd?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Roadrunner Convert Lanelet2 To Rrhd 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Roadrunner Convert Lanelet2 To Rrhd 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Roadrunner Convert Lanelet2 To Rrhd AI 技能免费吗?

matlab 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇