Main Content

SpanSequence

Define sequence of nodes connected by spans

Since R2025a

    Description

    The SpanSequence object represents a sequence of nodes connected by spans between each pair of adjacent nodes.

    A span sequence is an ordered collection of control points called nodes, connected by spans that define the shape and continuity of a road element, such as a reference line, lane marking, lane width profile, or elevation profile. Each node specifies a position along the road with associated attributes, such as, curvature, elevation, or width, while each span interpolates between two adjacent nodes to generate a smooth geometric transition.

    A span sequence represents the following:

    • For lane reference line, it defines the road alignment or vehicle trajectory.

    • For lane marking profiles, it describes how markings change over distance, such as,transitions between dashed and solid lines.

    • For lane width profiles, it models how lane widths vary along the length of the road.

    Creation

    To retrieve a SpanSequence object, extract the LaneMarkingProfile property or the WidthProfile property of a lane or a reference lane in your RoadRunner scene. For example, given the Lane object, rrLane, markingProfile = rrLane.LaneMarkingProfile extracts the LaneMarkingProfile property of the lane, which is a SpanSequence object. The marking profile is composed of a sequence of parametric spans, represented as an ordered collection of nodes connected by spans between each pair of adjacent nodes. Each node in the span sequence marks a specific location along the road at a certain distance, which is measured relative to the road, starting from the first node of the road’s reference line. The span, between each pair of adjacent nodes can have its own marking style.

    Properties

    expand all

    This property is read-only.

    Nodes of the specified span sequence, specified as an array of SpanSequenceNode objects.

    This property is read-only.

    Spans of the span sequence, specified as an array of SpanSequenceSpan objects.

    Object Functions

    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);
    

    Version History

    Introduced in R2025a

    See Also

    (RoadRunner) | (RoadRunner)