LaneMarkingNode
Description
The LaneMarkingNode
object represents a node in a lane
marking profile. 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.
Creation
To retrieve a LaneMarkingNode
object from a lane marking profile of
your RoadRunner scene, extract the Nodes
property of the corresponding
LaneMarkingProfile
object.
For example, markingNodes = LaneMarkingProfile1.Nodes
extracts all the
nodes in the marking profile LaneMarkingProfile1
and assigns them to the
variable markingNodes
.
Properties
Distance of the lane marking node in the span sequence representing the marking
profile, in meters, specified as a numeric scalar. The distance is relative to the start
of the road. By default, a lane marking profile consists of one span with two nodes, one
at the start and one at the end of the road. For the start node, the default distance is
0, while for the end node, the default distance is equal to the length of the road. You
can not change the distance values of the start and end nodes. You can add additional
nodes along the marking profile between the start and end nodes using the
insertNode
function. For these intermediate nodes, you can
specify a distance value within the range of 0 to the total length of the road.
This property is read-only.
Span connected at the start of a node in the lane marking profile, represented as a
LaneMarkingSpan
object.
This property is read-only.
Span connected at the end of a node in the lane marking profile, represented as a
LaneMarkingSpan
object.
Examples
This example shows how to create a RoadRunner scene with 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 100 meters long horizontal line-arc curve road 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 position of the start and end of the road. You can modify the position of the control points to adjust the length and direction of the road relative to the scene origin. You can also add additional control points in between the start and end points of the line-arc curve to adjust 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 are arranged outward from the reference line.
refLane = rrHorizontalRoad.ReferenceLane;
Use the getAsset
(RoadRunner Scenario) function to extract a solidYellowMarkingStyle
object, that represents the SolidSingleYellow.rrlms
asset in the project prj
. To define the marking profile of the reference lane, first extract refLaneMarkingProfile
object of the reference lane object refLane
. Then, extract the span object refLaneSpan
representing the span on which to place the lane marking using the Spans
property of the lane marking profile object refLaneMarkingProfile
. Now, use LaneMarkingStyle
property of the extracted span object to mark the reference lane with 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 refLane
object to add two driving lanes on either 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 of lane and the 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 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 a 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;
This figure shows the scene in the RoadRunner scene canvas.
This example shows how to create a RoadRunner scene having two-lane horizontal road with passing zone using span based lane markings. Passing zone allows a vehicle to safely change lanes while overtaking other slower moving vehicles.
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 100 meters long horizontal line-arc curve road 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 position of the start and end of the road. You can modify the position of the control points to adjust the length and direction of the road relative to the scene origin. You can also add additional control points in between the start and end points of the line-arc curve to adjust 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 are arranged outward from the reference line.
refLane = rrHorizontalRoad.ReferenceLane;
Use the getAsset
(RoadRunner Scenario) function to extract a dashedSolidYelloMarkingStyle
and SolidDoubleYelloMarkingStyle
objects. These objects represent the lane larking assets to use to mark the spans of the lane marking profile of the reference lane for creating the passing zones on the road.
dashedSolidYelloMarkingStyle = getAsset(prj,"<PROJECT>/Assets/Markings/DashedSolidYellow.rrlms","LaneMarkingStyle"); SolidDoubleYelloMarkingStyle = getAsset(prj,"<PROJECT>/Assets/Markings/SolidDoubleYellow.rrlms","LaneMarkingStyle");
To define the marking profile of the reference lane, extract refLaneMarkingProfile
object of the reference lane object refLane
using the LaneMarkingProfile
property.
refLaneMarkingProfile = refLane.LaneMarkingProfile;
To split the lane marking profile into four spans of 25 meters, insert three nodes in the lane marking profile at a distance of 25 meters, 50 meters and 75 meters.
insertNode(refLaneMarkingProfile,25); insertNode(refLaneMarkingProfile,50); insertNode(refLaneMarkingProfile,75);
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 = refLaneMarkingProfile.Spans(4); refLaneSpan.LaneMarkingStyle = SolidDoubleYelloMarkingStyle;
Add two driving lanes on either 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 of lane and the 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 solid single white marking style object solidWhiteMarkingStyle
and mark the boundaries of driving lanes.
solidWhiteMarkingStyle = getAsset(prj,"<PROJECT>/Assets/Markings/SolidSingleWhite.rrlms","LaneMarkingStyle"); horLane1MarkingProfile = horizontalLane1.LaneMarkingProfile; horLane1Span = horLane1MarkingProfile.Spans; horLane1Span.LaneMarkingStyle = solidWhiteMarkingStyle; horLane2MarkingProfile = horizontalLane2.LaneMarkingProfile; horLane2Span = horLane2MarkingProfile.Spans; horLane2Span.LaneMarkingStyle = solidWhiteMarkingStyle;
This figure shows the scene in the RoadRunner scene canvas.
Version History
Introduced in R2025a
See Also
roadrunnerAPI
| roadrunnerSetup
| getAsset
| Scene
| ReferenceLane
| addLineArcRoad
| LaneMarkingProfile
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)