주요 콘텐츠

roadrunner.hdmap.StencilMarking

Create stencil marking in RoadRunner HD Map using MATLAB

Since R2024b

    Description

    A roadrunner.hdmap.StencilMarking object enables you to define a stencil marking in a RoadRunner HD Map scene model.

    Creation

    Description

    stencilMarking = roadrunner.hdmap.StencilMarking creates an empty stencil marking.

    stencilMarking = roadrunner.hdmap.StencilMarking(Name=Value) sets the properties of the stencil marking using one or more name-value arguments. For example, ID="StencilMarking1" sets the ID of the stencil marking element to "StencilMarking1" .

    example

    Properties

    expand all

    ID of the stencil marking element, specified as a character vector or string scalar.

    Example: rrMap.StencilMarkings= roadrunner.hdmap.StencilMarking(ID="StencilMarking1") creates a curve marking with ID "StencilMarking1" in a RoadRunner HD Map.

    Data Types: char | string

    Geometry of the stencil marking, specified as a GeoOrientedBoundingBox (RoadRunner) message. Stencil markings fit within an oriented bounding box. Scale stencil markings to fit the bounds and then rotate them. See the GeoOrientation3 (RoadRunner) message for more information on how to handle rotation of objects.

    Data Types: vector

    Type of stencil marking, specified as a roadrunner.hdmap.Reference object.

    User-defined ancillary data, specified as a roadrunner.hdmap.Metadata object or a vector of roadrunner.hdmap.Metadata objects. Use a vector of roadrunner.hdmap.Metadata objects to assign multiple user-defined parameters to a stencil marking object.

    Examples

    collapse all

    Create an empty RoadRunner HD Map as a default roadrunnerHDMap object.

    rrMap = roadrunnerHDMap
    rrMap = 
      roadrunnerHDMap with properties:
    
                     Author: ""
               GeoReference: [0 0]
         GeographicBoundary: []
                      Lanes: [0×1 roadrunner.hdmap.Lane]
                SpeedLimits: [0×1 roadrunner.hdmap.SpeedLimit]
             LaneBoundaries: [0×1 roadrunner.hdmap.LaneBoundary]
                 LaneGroups: [0×1 roadrunner.hdmap.LaneGroup]
               LaneMarkings: [0×1 roadrunner.hdmap.LaneMarking]
                  Junctions: [0×1 roadrunner.hdmap.Junction]
               BarrierTypes: [0×1 roadrunner.hdmap.BarrierType]
                   Barriers: [0×1 roadrunner.hdmap.Barrier]
                  SignTypes: [0×1 roadrunner.hdmap.SignType]
                      Signs: [0×1 roadrunner.hdmap.Sign]
          StaticObjectTypes: [0×1 roadrunner.hdmap.StaticObjectType]
              StaticObjects: [0×1 roadrunner.hdmap.StaticObject]
        StencilMarkingTypes: [0×1 roadrunner.hdmap.StencilMarkingType]
            StencilMarkings: [0×1 roadrunner.hdmap.StencilMarking]
          CurveMarkingTypes: [0×1 roadrunner.hdmap.CurveMarkingType]
              CurveMarkings: [0×1 roadrunner.hdmap.CurveMarking]
                SignalTypes: [0×1 roadrunner.hdmap.SignalType]
                    Signals: [0×1 roadrunner.hdmap.Signal]
    
    

    Create a stencil marking by using a roadrunner.hdmap.StencilMarking object. Specify the stencil marking ID.

    rrMap.StencilMarkings = roadrunner.hdmap.StencilMarking(ID="StencilMarking1")
    rrMap = 
      roadrunnerHDMap with properties:
    
                     Author: ""
               GeoReference: [0 0]
         GeographicBoundary: []
                      Lanes: [0×1 roadrunner.hdmap.Lane]
                SpeedLimits: [0×1 roadrunner.hdmap.SpeedLimit]
             LaneBoundaries: [0×1 roadrunner.hdmap.LaneBoundary]
                 LaneGroups: [0×1 roadrunner.hdmap.LaneGroup]
               LaneMarkings: [0×1 roadrunner.hdmap.LaneMarking]
                  Junctions: [0×1 roadrunner.hdmap.Junction]
               BarrierTypes: [0×1 roadrunner.hdmap.BarrierType]
                   Barriers: [0×1 roadrunner.hdmap.Barrier]
                  SignTypes: [0×1 roadrunner.hdmap.SignType]
                      Signs: [0×1 roadrunner.hdmap.Sign]
          StaticObjectTypes: [0×1 roadrunner.hdmap.StaticObjectType]
              StaticObjects: [0×1 roadrunner.hdmap.StaticObject]
        StencilMarkingTypes: [0×1 roadrunner.hdmap.StencilMarkingType]
            StencilMarkings: [1×1 roadrunner.hdmap.StencilMarking]
          CurveMarkingTypes: [0×1 roadrunner.hdmap.CurveMarkingType]
              CurveMarkings: [0×1 roadrunner.hdmap.CurveMarking]
                SignalTypes: [0×1 roadrunner.hdmap.SignalType]
                    Signals: [0×1 roadrunner.hdmap.Signal]
    
    

    Add a stencil marking to a road in a RoadRunner HD Map, and build a RoadRunner scene using the HD Map.

    Create an empty RoadRunner HD Map by using the roadrunnerHDMap object.

    rrMap = roadrunnerHDMap;

    Create a road lane 50 meters in length using the roadrunner.hdmap.Lane object. Specify the lane ID, coordinates defining the centerline of the lane, driving direction, and lane type.

    rrMap.Lanes(1) = roadrunner.hdmap.Lane(ID="Lane",Geometry=[0 0; 0 50],TravelDirection="Forward",LaneType="Driving");

    Create the lane boundaries of the road using the roadrunner.hdmap.LaneBoundary object. For each boundary, specify the lane ID and the coordinates that define the points of the lane boundary.

    rrMap.LaneBoundaries(1) = roadrunner.hdmap.LaneBoundary(ID="Left",Geometry=[-5 0; -5 50]);
    rrMap.LaneBoundaries(2) = roadrunner.hdmap.LaneBoundary(ID="Right",Geometry=[5 0; 5 50]);

    Link the lane boundaries to the lane. Define the left and the right lane boundaries for the lane, and specify the alignment between the lane and lane boundaries.

    leftBoundary(rrMap.Lanes(1),"Left",Alignment="Forward");
    rightBoundary(rrMap.Lanes(1),"Right",Alignment="Forward");

    To add a stop type stencil marking to the road, first extract the corresponding stencil marking asset by using the roadrunner.hdmap.RelativeAssetPath object. For more information about these assets, see RoadRunner Asset Types (RoadRunner).

    pathStencilMarking = roadrunner.hdmap.RelativeAssetPath(AssetPath="Assets/Stencils/Stencil_STOP.svg");

    Now, create a stencil marking element that refers to the extracted stencil marking asset by using the roadrunner.hdmap.StencilMarkingType object. Specify the stencil marking ID and the path to the stop asset.

    rrMap.StencilMarkingTypes(1) = roadrunner.hdmap.StencilMarkingType(ID="StopStencilType",AssetPath=pathStencilMarking);

    Create a reference to the stencil marking using the roadrunner.hdmap.Reference object.

    stencilMarkingRef = roadrunner.hdmap.Reference(ID="StopStencilType");

    Define the geometry of the stencil marking as an oriented bounding box by using the roadrunner.hdmap.GeoOrientedBoundingBox object, and add the stencil to the road in the HD Map.

    GeoOriBBStencil = roadrunner.hdmap.GeoOrientedBoundingBox(Center=[0 40 0],Dimension=[2 2 2]);
    rrMap.StencilMarkings(1) = roadrunner.hdmap.StencilMarking(ID="StopStencilType",Geometry=GeoOriBBStencil,MarkingTypeReference=stencilMarkingRef);

    Write the modified HD Map to a binary file.

    filename = "MyMap.rrhd";
    write(rrMap,filename)

    To open RoadRunner using MATLAB®, first specify the path to your RoadRunner project. This code shows the path for a sample project folder location in Windows®. If you are using RoadRunner for the first time, you must install RoadRunner and activate your RoadRunner license. For more information, see Install and Activate RoadRunner (RoadRunner).

    rrProjectPath = "C:\RR\MyProject";

    Specify the path to your local RoadRunner installation folder. This code shows the path for the default installation location in Windows.

    rrAppPath = "C:\Program Files\RoadRunner R2025b\bin\win64";

    Open RoadRunner using the roadrunner object from the MATLAB command line. Alternatively, you can start the RoadRunner application interactively, using the roadrunnerSetup (RoadRunner) function. This function opens a dialog box to specify the project folder and installation folder to use when opening RoadRunner.

    rrApp = roadrunner(rrProjectPath,InstallationFolder=rrAppPath);

    Import the RoadRunner HD Map file MyMap.rrhd into your RoadRunner scene, and build the RoadRunner HD Map data. Before you build the scene, you must activate your RoadRunner Scene Builder license. RoadRunner Scene Builder is an add-on product that requires an addition to your RoadRunner license. For more details, see RoadRunner Scene Builder.

    file = fullfile(pwd,"MyMap.rrhd");
    importScene(rrApp,file,"RoadRunner HD Map");

    This figure shows the built scene in the RoadRunner canvas.

    RoadRunner scene with a single‑lane road and a stop sign at the end of the road.

    Version History

    Introduced in R2024b