LaneWidthNode
Description
The LaneWidthNode
object represents a node in a lane width
profile. A lane width 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 sequence represents a specific location along the road and contains information about
the lane width and the slope of the width at that point. RoadRunner represents the position of each node as its distance from the starting point of
the reference line of the road.
Creation
To retrieve the LaneWidthNode
objects from a lane width profile in your
RoadRunner scene, extract the Nodes
property of the corresponding LaneWidthProfile
object. For
example, widthNodes = LaneWidthProfile1.Nodes
extracts all the nodes in the
lane width profile LaneWidthProfile1
.
Properties
Width of the span at the start of node, in meters, specified as a numeric scalar in the range [0, 200].
Width of the span at the end of node which, in meters, specified as a numeric scalar in the range [0, 200].
Slope at the start of the node, specified as a numeric scalar. Negative values slope outward from the reference lane of the road.
Slope at the end of the node, specified as a numeric scalar. Negative values slope inward to the reference lane of the road.
Distance of the node along the span sequence representing the width profile, in
meters, specified as a numeric scalar. The distance is relative to the start of the
road. By default, a lane width 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
add additional nodes along the width profile between the start and end nodes using the
insertNode
function.
For these intermediate nodes, you can specify a distance value within the range (0,
N), where N is the total length of the
road.
This property is read-only.
Span connected at the start of a node in the lane width profile, represented as a
LaneWidthSpan
object.
This property is read-only.
Span connected at the end of a node in the lane width profile, represented as a
LaneWidthSpan
object.
Examples
Create a RoadRunner scene with a horizontal road that contains multiple driving lanes and a single merge lane. Merge lanes enable vehicles to safely converge from multiple lanes to a single lane, such as due to a narrowing road or lane closures.
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 road 200 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 between the start and end points of the line-arc curve to adjust the curvature and radius of the road curve.
controlPoints = [-100 0; 100 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 DashedSingleWhite.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 dashed white marking style.
dashedWhiteMarkingStyle = getAsset(prj,"<PROJECT>/Assets/Markings/DashedSingleWhite.rrlms","LaneMarkingStyle"); refLaneMarkingProfile = refLane.LaneMarkingProfile; refLaneSpan = refLaneMarkingProfile.Spans; refLaneSpan.LaneMarkingStyle = dashedWhiteMarkingStyle;
Add a driving lane on the left side of the horizontal road with a forward direction of travel by using the addLaneToLeft
function. Use the LaneType
and TravelDirection
properties of the added lanes to specify the type and travel direction of the lane.
horizontalLane1 = addLaneToLeft(refLane); horizontalLane1.LaneType = "Driving"; horizontalLane1.TravelDirection = "Forward";
Split the lane marking profile into four spans by inserting two nodes, at distances of 90 meters and 110 meters, by using the insertNode
function.
insertNode(horizontalLane1.LaneMarkingProfile,90); insertNode(horizontalLane1.LaneMarkingProfile,110);
Extract the object that represents the lane marking profile of the lane from the LaneMarkingProfile
property of the horizontalLane1
object. The lane marking profile represents the markings on the outer boundary of the lane.
horLane1MarkingProfile = horizontalLane1.LaneMarkingProfile;
Now, extract the span object horLane1Span
, which represents the span on which to place the desired lane marking, from the Spans
property of the lane marking profile object horLane1MarkingProfile
. Mark the first span of the lane marking profile with dashed white marking type.
horLane1Span = horLane1MarkingProfile.Spans(1); horLane1Span.LaneMarkingStyle = dashedWhiteMarkingStyle;
Extract a lane marking style object, solidWhiteMarkingStyle
, that represents the solid single white marking style, and use it to mark the third span of the lane marking profile.
solidWhiteMarkingStyle = getAsset(prj,"<PROJECT>/Assets/Markings/solidsingleWhite.rrlms","LaneMarkingStyle"); horizontalLane1Span = horizontalLane1.LaneMarkingProfile.Spans(3); horizontalLane1Span.LaneMarkingStyle = solidWhiteMarkingStyle;
Add a driving lane on the right side of the horizontal road with a forward direction of travel, and mark its boundary with the solid single white marking style.
horizontalLane2 = addLaneToRight(refLane); horizontalLane2.LaneType = "Driving"; horizontalLane2.TravelDirection = "Forward"; horLane2MarkingProfile = horizontalLane2.LaneMarkingProfile; horLane2Span = horLane2MarkingProfile.Spans; horLane2Span.LaneMarkingStyle = solidWhiteMarkingStyle;
Add a merge lane to the left of the first horizontal lane, and add the solid white marking style to it.
shortLane = addLaneToLeft(horizontalLane1); shortLane.LaneType = "Driving"; shortLane.TravelDirection = "Forward"; shortLaneSpan = shortLane.LaneMarkingProfile.Spans(1); shortLaneSpan.LaneMarkingStyle = solidWhiteMarkingStyle;
Configure the width profile for the merge lane by specifying the WidthProfile
property of the lane. The merge lane width reduces to 0 at 110 meters from the start of the road. To create a width profile at the boundary of the merge lane, insert a node at 90 meters from the start of the road, and set the start and end slope of the node using the StartSlope
and EndSlope
properties, respectively. By specifying the slope at the start and end of the final node of the width profile, and specifying a width of 0, the width profile gradually reduces the merge lane to a width of 0.
shortLaneWidthProfile = shortLane.WidthProfile; widthChangingNode = insertNode(shortLaneWidthProfile,90); widthChangingNode.StartSlope = 0; widthChangingNode.EndSlope = 0.10; endNode = shortLaneWidthProfile.Nodes(end); endNode.Distance = 110; endNode.StartWidth = 0; endNode.EndWidth = 0; endNode.StartSlope = 0.10; endNode.EndSlope = 0.0;
Version History
Introduced in R2025a
See Also
roadrunnerAPI
| roadrunnerSetup
| getAsset
| Scene
| Lane
| ReferenceLane
| addLineArcRoad
| LaneWidthProfile
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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- 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)