Main Content

LaneMarkingStyle

Marking style of lane boundary in RoadRunner scene

Since R2025a

    Description

    The LaneMarkingStyle object represents a lane marking asset type in the RoadRunner project. Lane marking assets describe the properties of lane markings, such as color, width, and dash spacing. Use LaneMarkingStyle objects to represent the marking styles of lane boundaries in a scene. For more information on lane marking assets, see Lane Marking Assets (RoadRunner).

    Creation

    The getAsset function extracts an object for the asset of the specified asset type at the specified path relative to the Asset folder of the specified project. Specify the assetType argument as "LaneMarkingStyle" to extract a LaneMarkingStyle object.

    Properties

    expand all

    This property is read-only.

    Relative path to the lane marking asset in the RoadRunner project, represented as a string scalar.

    Examples

    collapse all

    Create a RoadRunner scene with a four-lane horizontal road and add markings to the boundaries of the lanes.

    Create a roadrunner object, specifying the path to an existing project. For example, this code shows the path to a project, on a Windows® machine, located at "C:\RR\MyProject". This code assumes that RoadRunner is installed in the default location, and returns an object, rrApp, that provides functions for performing basic tasks such as opening, closing, and saving scenes and projects.

    rrApp = roadrunner(ProjectFolder="C:\RR\MyProject");

    Note: If you are opening RoadRunner from MATLAB® for the first time, or if you have changed the RoadRunner installation location since you last opened it from MATLAB, you can use the roadrunnerSetup (RoadRunner) function to specify new default project and installation folders to use when opening RoadRunner. You can save these folders between MATLAB sessions by selecting the Across MATLAB sessions option from the corresponding drop down.

    Create a new RoadRunner scene in the current project by using the newScene function, specifying the roadrunner object rrApp.

    newScene(rrApp);

    Create an object for the RoadRunner authoring API, rrApi, that references the object for the current RoadRunner instance rrApp. The rrApi object enables you to programmatically author scenes, such as by adding and modifying road and lanes components, using MATLAB.

    rrApi = roadrunnerAPI(rrApp);

    Extract the object for your scene from the Scene property of the authoring API object rrApi. The extracted Scene object enables you to specify the scene in which to add scene elements such as roads and lanes.

    scn = rrApi.Scene;

    Extract the Project object for your RoadRunner project from the Project property of the authoring API object rrApi. The extracted Project object enables you to specify the project folder for the current RoadRunner session from which to retrieve asset objects. You can use the asset objects to assign markings to the lanes in your scene.

    prj = rrApi.Project;

    Add a horizontal line-arc curve road 100 meters in length to the scene by using the addLineArcRoad function. Specify the position of the road by specifying the positions of its control points along the X- and Y-axes of the RoadRunner local coordinate system. These control points define the positions of the start and end of the road. You can modify the positions of the control points to adjust the length and direction of the road relative to the scene origin. You can also add control points in between the start and end points of the line-arc curve to adjust the curvature and radius of the road curve.

    controlPoints = [-50 0; 50 0];
    rrHorizontalRoad = addLineArcRoad(scn,controlPoints);

    Extract the reference lane of the road from the ReferenceLane property of the road object rrHorizontalRoad. The reference lane defines the center lane, or reference line, of a road in a RoadRunner scene. This lane has no width and serves as the basis for positioning all other lanes, which RoadRunner arranges outward from the reference line.

    refLane = rrHorizontalRoad.ReferenceLane;

    Use the getAsset (RoadRunner Scenario) function to extract a lane marking style object, which represents the SolidSingleYellow.rrlms asset, from the project prj. To define the marking profile of the reference lane, first extract the lane marking profile object refLaneMarkingProfile of the reference lane object refLane. Then, extract the lane marking span object refLaneSpan, which represents the span on which to place the lane marking, from the Spans property of the lane marking profile object refLaneMarkingProfile. Lastly, set the LaneMarkingStyle property of the extracted span object to mark the reference lane with the solid yellow marking style.

    solidYellowMarkingStyle = getAsset(prj,"<PROJECT>/Assets/Markings/SolidSingleYellow.rrlms","LaneMarkingStyle");
    refLaneMarkingProfile = refLane.LaneMarkingProfile;
    refLaneSpan = refLaneMarkingProfile.Spans;
    refLaneSpan.LaneMarkingStyle = solidYellowMarkingStyle;

    Use the extracted reference lane object refLane to add a driving lane on each side of the reference lane of the road using the addLaneToLeft and addLaneToRight functions. Then, use the LaneType and TravelDirection properties of the added lanes to specify the type and travel direction of each lane.

    horizontalLane1 = addLaneToLeft(refLane);
    horizontalLane1.LaneType = "Driving";
    horizontalLane1.TravelDirection = "Forward";
    horizontalLane2 = addLaneToRight(refLane);
    horizontalLane2.LaneType = "Driving";
    horizontalLane2.TravelDirection = "Backward";

    Extract the dashed single white marking style object dashedWhiteMarkingStyle, and mark the boundaries of the driving lanes.

    dashedWhiteMarkingStyle = getAsset(prj,"<PROJECT>/Assets/Markings/DashedSingleWhite.rrlms","LaneMarkingStyle");
    horLane1MarkingProfile = horizontalLane1.LaneMarkingProfile;
    horLane1Span = horLane1MarkingProfile.Spans;
    horLane1Span.LaneMarkingStyle = dashedWhiteMarkingStyle;
    horLane2MarkingProfile = horizontalLane2.LaneMarkingProfile;
    horLane2Span = horLane2MarkingProfile.Spans;
    horLane2Span.LaneMarkingStyle = dashedWhiteMarkingStyle;

    Add one border lane to the left of the first horizontal lane and another border lane to the right of the second horizontal lane. Extract the solid single white marking style object solidWhiteMarkingStyle, and mark the boundaries of the border lanes.

    endLane1 = addLaneToLeft(horizontalLane1);
    endLane1.LaneType = "Border";
    endLane1.TravelDirection = "Forward";
    endLane2 = addLaneToRight(horizontalLane2);
    endLane2.LaneType = "Border";
    endLane2.TravelDirection = "Backward";
    solidWhiteMarkingStyle = getAsset(prj,"<PROJECT>/Assets/Markings/SolidSingleWhite.rrlms","LaneMarkingStyle");
    endLane1MarkingProfile = endLane1.LaneMarkingProfile;
    endLane1Span = endLane1MarkingProfile .Spans;
    endLane1Span.LaneMarkingStyle = solidWhiteMarkingStyle;
    endLane2MarkingProfile = endLane2.LaneMarkingProfile;
    endLane2Span = endLane2MarkingProfile.Spans;
    endLane2Span.LaneMarkingStyle = solidWhiteMarkingStyle;

    RoadRunner scene of a road with four driving lanes. The reference lane of the road is marked with the solid yellow marking style. The outer boundaries of the inner driving lanes are marked with dashed white and the outer boundaries of the outer driving lanes are marked with solid white

    Version History

    Introduced in R2025a