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 a new scene in RoadRunner by using the newScene
function, specifying the
roadrunner
object 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.
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 components, such as roads and lanes.
Use the addSegmentedRoad
function to add a segmented curve type
road to the scene. Specify the starting point of the road as a control point. Next,
indicate the forward direction of the road by specifying a second control point. You
must specify the positions of these control points along the X- and Y- axes of the
RoadRunner local coordinate
system.
Extract the horizontal curve of the segmented road. Then, use the
addLine
function to create a road segment and add it to the
horizontal curve. Specify the length of the line segment as 50
m.
Use the addArc
function to create an arc segment and add it to
the road. Specify the length of the arc segment as 30
m and its
curvature as 1/20
m.
Use the addLine
function to create another horizontal segment
and add it to the road. Specify the length of the line segment as
40
m.