Road
Description
The Road object represents an instance of a road in the
current RoadRunner scene. You can use the Road object to modify the reference
curve that the road layout is based on, such as by modifying travel direction, adding lanes,
and adding lane markings.
Creation
You can create a Road object in these ways:
The
addLineArcRoadfunction creates a new line-arc curve at the specified position in the specified scene.The
addSegmentedRoadfunction creates a new segmented curve at the specified position in the specified scene.The
addClothoidFitRoadfunction creates a segmented curve type road in the specified scene by using a clothoid curve fit for the horizontal road curve and a cubic fit for the vertical road curve.
Properties
Vertical curve of the road, specified as one of these objects:
QuadraticVerticalRoadCurveobject — Represents a quadratic vertical road curve. RoadRunner interpolates the height between node positions and smoothly curves the road through the blend range.CubicVerticalRoadCurveobject — Represents a cubic vertical road curve. To interpolate the road curve height between the start and end nodes, RoadRunner interpolates both the elevation and the slope between those nodes.
Horizontal curve of the road, specified as one of these objects:
object — Represents a line-arc road curve that uses control points to define the curve.LineArcRoadCurveobject — Represents a segmented road curve that supports using line, arc, spiral, and parametric cubic road segments to define the curve.SegmentedRoadCurve
Reference lane of the road, specified as a
object. The reference lane
enables you to specify the relative positions, sequence, and lane marking profiles of
the ReferenceLaneLanes on the
road.
Lanes of the road, specified as a object or an array of
LaneLane objects.
Road superelevation or banking angle profile, specified as a
SuperElevationCurve object. The superelevation curve defines how
the lateral banking angle of the road surface varies continuously along the length of
the road.
A superelevation curve consists of these components:
SuperElevationNodeobjects - Define banking angles at specified distances along the roadSuperElevationSpanobjects - Interpolate banking angles smoothly between adjacent nodes
Examples
Use the addLineArcRoad
function to add two intersecting roads to the scene scn. Then, use
the
and addLaneToLeft functions to add lanes to
each side of both roads.addLaneToRight
Create a object, specifying the path
to an existing project. For example, this code shows the path to a project, on a
Windows® machine, located at roadrunner"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 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 and scenarios, such as by adding and modifying roads, actors,
and logic components, using MATLAB.
rrApi = roadrunnerAPI(rrApp);
Scene and
Scenario properties of the authoring API object rrApi,
respectively. The extracted Scene object enables you to specify the scene in
which to add scene components such as roads and lanes. The extracted Scenario (RoadRunner Scenario) object
enables you to specify the scenario in which to add scenario components such as actors and
logic.scn = rrApi.Scene; scnro = rrApi.Scenario;
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 assets to roads in your scene, or to actors in your
scenario.prj = rrApi.Project;
Use addLineArcRoad to Add Roads
Use to add two roads,
addLineArcRoadroad1 and road2, to the scene. Specify the
positions of the roads by specifying the positions of their control points along the
X- and Y-axes of the RoadRunner local coordinate system. Set the control points of
road1 to -100 and 100 on
the X-axis. Then, to create an intersection, specify the positions of the control
points for road2 as 50 and
-50 on the Y-axis.
road1 = addLineArcRoad(scn,[-100 0; 100 0]); road2 = addLineArcRoad(scn,[0 50; 0 -50]);
By default, roads do not have any lanes and RoadRunner displays only their reference lanes in the scene editor. To add lanes to
roads, extract the reference lane objects from the properties of
ReferenceLaneroad1 and road2.
road1Ref = road1.ReferenceLane; road2Ref = road2.ReferenceLane;
Use the
and addLaneToLeft functions to add lanes
to the left and right of both roads by specifying their addLaneToRight
objects.ReferenceLane
leftLane1 = addLaneToLeft(road1Ref); rightLane1 = addLaneToRight(road1Ref); leftLane2 = addLaneToLeft(road2Ref); rightLane2 = addLaneToRight(road2Ref);
You can use Road objects to create road networks in your scene
to use for scenario simulation in RoadRunner Scenario. For more information on creating roads in RoadRunner, see the Road Plan Tool (RoadRunner).
Version History
Introduced in R2025aYou can now specify how the lateral banking angle of the road varies along its length
using the new SuperElevationCurve property.
See Also
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)