メインコンテンツ

addSuperElevation

Add or update road superelevation or banking angle at point

Since R2026a

    Description

    addSuperElevation(road,distance,angle) adds or updates road banking (superelevation) at a specified point along a road. When you use the addSuperElevation, RoadRunner checks whether a superelevation node already exists at each specified distance. If a node exists, the function updates its banking angle. If no node exists, the function inserts a new superelevation node.

    example

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

    prj = rrApi.Project;

    Use the addClothoidFitRoad function to add a new road. Specify the position of the road by specifying the positions of its start point startPt and end point endPt.

    startPt = [0 0 0];
    endPt = [50 0 0];
    rrRoad = addClothoidFitRoad(scn,[startPt; endPt]);

    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 extracted refLane object to add lanes on either side of the reference lane of the road using the addLaneToLeft and addLaneToRight functions.

    leftLane = addLaneToLeft(refLane);
    rightLane = addLaneToRight(refLane);

    Use the getAsset function to retrieve the LaneMarkingStyle objects for a dashed 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.

    dashedWhiteMarkingStyle = prj.getAsset("<PROJECT>/Assets/Markings/DashedSingleWhite.rrlms","LaneMarkingStyle");
    solidWhiteMarkingStyle = prj.getAsset("<PROJECT>/Assets/Markings/SolidSingleWhite.rrlms","LaneMarkingStyle");

    Mark the boundaries of the lanes.

    leftLaneSpan = leftLane.LaneMarkingProfile.Spans(1);
    leftLaneSpan.LaneMarkingStyle = solidWhiteMarkingStyle;
    rightLaneSpan = rightLane.LaneMarkingProfile.Spans(1);
    rightLaneSpan.LaneMarkingStyle = solidWhiteMarkingStyle;
    referenceLaneSpan = refLane.LaneMarkingProfile.Spans(1);
    referenceLaneSpan.LaneMarkingStyle = dashedWhiteMarkingStyle;

    RoadRunner scene canvas showing the creation of road

    Access the superelevation definition of the road by extracting its property.

    seCurve = rrRoad.SuperElevationCurve;

    Inspect the default superelevation nodes of the road. By default, the SuperElevationCurve contains two nodes: one at the start of the road and one at the end of the road.

    nodes = seCurve.Nodes

    Apply Uniform Banking Along the Entire Road

    Set the same banking angle along the entire length of a road using a single call to addSuperElevation.

    addSuperElevation(rrRoad,50,10); % 50 indicates total length of the road

    RoadRunner scene canvas showing uniform banking along the entire road

    Define Non-Uniform Banking Using Start and End Nodes

    Assign different banking angles at the start and end of the road to create a continuous banking transition.

    nodes(1).Angle = 15;
    nodes(end).Angle = -15;

    RoadRunner scene canvas showing non-uniform banking at the start and end of the road

    You can also use the addSuperElevation function to define different banking angles at the start and end of the road.

    addSuperElevation(rrRoad,0,15)   % 0 indicates the start position of the road
    addSuperElevation(rrRoad,50,-15) % 50 indicates the end position of the road

    Insert Intermediate Superelevation Nodes

    Insert a new superelevation control point at a specified distance along the road.

    midNode = insertNode(seCurve,25);
    midNode.Angle = -10;

    Insert another superelevation node between the start node and your new midpoint node.

    addSuperElevation(rrRoad,12,-10);

    RoadRunner scene canvas showing the new node inserted at the specified distance

    Create Multiple Banking Transitions Along the Road

    Insert multiple nodes to define several banking transitions.

    distances = [10 20 35];
    angles = [5 -10 15];
    addSuperElevation(rrRoad,distances,angles);
    The function processes each distance-angle pair and returns an array of the newly created or updated superelevation nodes in the same order as the inputs.

    RoadRunner scene canvas showing the creation of multiple banking transitions along the road

    Input Arguments

    collapse all

    Road to which to apply banking, specified as a Road object. The road must be a valid RoadRunner road that supports superelevation.

    Distance along the road at which to define the superelevation angle, specified as a numeric scalar or numeric vector. Units are in meters. Distances are measured relative to the start of the road reference line, and must lie within the range [0, Length], where 0 is the start of the road and Length is the total length of the road.

    Specify this value as a vector to specify locations for multiple superelevation nodes at once.

    Data Types: single | double

    Superelevation angle, specified as a numeric scalar or numeric vector. Units are in degrees. Valid values must lie within the range −60 to 60 degrees.

    If angle is a scalar, the function applies the same banking angle to every node indicated by distance.

    If angle is a vector, it must be the same size as distance, and each value defines the banking angle at the corresponding distance.

    Data Types: double

    Version History

    Introduced in R2026a