insertNode
Description
inserts a new node at a specified distance in the span sequence. The inserted node allows
precise manipulation of the span sequence by acting as its localized control point. The
position of each node is specified by its distance from the starting point of the reference
line of the road.spanNode
= insertNode(spanSequence
,distance
)
Examples
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);
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);
Input Arguments
Span sequence, specified as a SpanSequence
object.
Distance of the node along the span sequence specified as a numeric scalar. Units
are in meters. This distance is measured relative to the start of the span sequence and
must lie within the range [0, total length of the span
sequence]
.
By default, a span sequence in RoadRunner includes two fixed nodes— one at the start (0
meters)
and one at the end (equal to the total length of the span sequence). These nodes define
the initial span and cannot be repositioned. You can add additional nodes at custom
distances along the span sequence.
Data Types: double
Output Arguments
New node inserted in the span sequence, returned as a
SpanSequenceNode
object.
Version History
Introduced in R2025a
See Also
SpanSequence
(RoadRunner) | SpanSequenceNode
(RoadRunner) | SpanSequenceSpan
(RoadRunner) | Scene
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)