Main Content

SpanSequenceSpan

Define span between two nodes in span sequence

Since R2025a

    Description

    The SpanSequenceSpan object represents the span between two adjacent nodes in a span sequence. The object defines the exact path and the spatial relationship between two adjacent nodes to describe the transition from one position to the next along a road or lane.

    Creation

    To retrieve a SpanSequenceSpan object from a lane marking profile from your RoadRunner scene, extract the Spans property of the corresponding LaneMarkingProfile object. For example, markingSpans = LaneMarkingProfile.Spans extracts all the spans in the marking profile and assigns them to the variable markingSpans.

    Properties

    expand all

    This property is read-only.

    Node at the start of the specified span sequence, specified as a SpanSequenceNode object. The StartNode is the first node of a SpanSequenceSpan. It defines the initial position and orientation of the span sequence along the road geometry.

    This property is read-only.

    Node at the end of the span sequence, specified as a SpanSequenceNode object. It defines the terminal position and orientation of the span sequence along the road geometry.

    Examples

    collapse all

    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 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 scene in RoadRunner by using the newScene function, specifying the roadrunner object rrApp.

    newScene(rrApp)
    

    Create a RoadRunner authoring API object, 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 lane 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 components, such as roads and lanes.
    scn = rrApi.Scene;

    Extract the object for your RoadRunner project from the Project property of the authoring API object rrApi. The extracted Project (RoadRunner)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 add lane markings to the lanes in your scene.

    scn = rrApi.Project;

    Use the addLineArcRoad function to add a new road with a line-arc horizontal curve type to the scene. 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. Set the control points of the road to -100 and 50 on the X- axis and Y- axis, respectively.

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

    Extract the reference lane from the ReferenceLane property of the road rrRoad. The extracted property ReferenceLane defines the center line of the road.

    refLane = rrRoad.ReferenceLane;

    Use the getAsset function to retrieve the LaneMarkingStyle objects for dashed solid yellow lane marking and solid yellow lane marking. These objects define the lane marking assets used to mark the spans in the lane marking profile of the reference lane.

    dashedSolidYellowMarkingStyle = getAsset(prj, "<PROJECT>/Assets/Markings/DashedSolidYellow.rrlms", "LaneMarkingStyle");
    solidDoubleYellowMarkingStyle = getAsset(prj, "<PROJECT>/Assets/Markings/SolidDoubleYellow.rrlms", "LaneMarkingStyle");

    Use the LaneMarkingProfile property of the refLane object to extract the lane marking profile of the reference lane.

    refLaneMarkingProfile = refLane.LaneMarkingProfile;

    Insert nodes in the lane marking profile at three 30-meter spans using the insertNode function. This divides the lane marking profile into four spans by inserting nodes at 30 meters, 60 meters, and 90 meters.

    insertNode(refLaneMarkingProfile, 30);
    insertNode(refLaneMarkingProfile, 60);
    insertNode(refLaneMarkingProfile, 90);
    

    Now, extract the individual span object refLaneSpan representing the span on which to place the desired lane marking using the Spans property of the lane marking profile object refLaneMarkingProfile. Mark the first and the third span with dashed solid yellow marking type and the second and fourth span with solid double yellow marking type. These markings denote passing zones on the road where vehicles are allowed to change lanes.

    refLaneSpan = refLaneMarkingProfile.Spans(1);
    refLaneSpan.LaneMarkingStyle = dashedSolidYelloMarkingStyle;
    refLaneSpan = refLaneMarkingProfile.Spans(2);
    refLaneSpan.LaneMarkingStyle = SolidDoubleYelloMarkingStyle;
    refLaneSpan = refLaneMarkingProfile.Spans(3);
    refLaneSpan.LaneMarkingStyle = dashedSolidYelloMarkingStyle;
    refLaneSpan = refLane.refLaneMarkingProfile.Spans(4);
    refLaneSpan.LaneMarkingStyle = SolidDoubleYelloMarkingStyle;
    

    Version History

    Introduced in R2025a

    See Also

    (RoadRunner) | (RoadRunner) | (RoadRunner)