LaneMarkingProfile
Description
The LaneMarkingProfile
object defines the marking profile for
either a reference lane or the outer boundary of a road lane within a RoadRunner scene. Use this object to specify different types of lane markings along the
length of the outer boundary of a lane. A lane marking profile consists 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, measured relative to the road, starting from the first node of
the road reference line. Each span between a pair of adjacent nodes can have its own marking
style, which enables you to create complex and realistic road layouts, including transitions
between marking types, lane merges, or different sections of road.
Creation
To retrieve the LaneMarkingProfile
object of a lane or a reference lane
from your RoadRunner scene, extract the LaneMarkingProfile
property of the lane or
the reference lane. For example, markingProfile1 =
rrLane1.LaneMarkingProfile
extracts the LaneMarkingProfile
property of the lane rrLane1
.
Properties
This property is read-only.
Nodes of the span sequence in the lane marking profile, represented as an array of
LaneMarkingNode
objects.
This property is read-only.
Spans of the span sequence in the lane marking profile, represented as an array of
LaneMarkingSpan
objects.
Object Functions
insertNode | Insert node in span sequence |
Examples
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;
Create a RoadRunner scene that has two-lane horizontal road with a passing zone by using span-based lane markings. A passing zone enables a vehicle to safely change lanes while overtaking 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 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 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 lane marking style objects, which represent the DashedSolidYellow.rrlms
and SolidDoubleYellow.rrlms
assets, from the project. You can use these objects to mark the spans of the lane marking profile of the reference lane when creating 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 the lane marking profile object of the reference lane object refLane
from
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 distances of 25 meters, 50 meters, and 75 meters.
insertNode(refLaneMarkingProfile,25); insertNode(refLaneMarkingProfile,50); insertNode(refLaneMarkingProfile,75);
Now, individually extract each span object that represents the span on which to place a desired lane marking from the Spans
property of the lane marking profile object refLaneMarkingProfile
. Mark the first and the third spans with the dashed solid yellow marking type and the second and fourth spans with the 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;
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 solid single white marking style object, and mark the boundaries of the 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;
Version History
Introduced in R2025a
See Also
roadrunnerAPI
| roadrunnerSetup
| getAsset
| Scene
| Lane
| ReferenceLane
| addLineArcRoad
| LaneMarkingStyle
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.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)