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.
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.
Extract the scene and scenario objects from the
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.
Extract the 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 assets to roads in your scene, or to actors in your
scenario.
Use addLineArcRoad
to Add Roads
Use addLineArcRoad
to add two roads, road1
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.
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 ReferenceLane
properties of road1
and road2
.
Use the addLaneToLeft
and addLaneToRight
functions to add lanes to the left and right of both roads by specifying their
ReferenceLane
objects.
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).