To create a road by using the road
function, specify the road centers as a
matrix input. The function creates a directed line that traverses the road centers, starting
from the coordinates in the first row of the matrix and ending at the coordinates in the last
row of the matrix. The coordinates in the first two rows of the matrix specify the
draw direction of the road. These coordinates correspond to the first
two consecutive road centers. The draw direction is the direction in which the roads render in
the scenario plot.
To create a road by using the Driving Scenario
Designer app, you can either specify the Road Centers parameter
or interactively draw on the Scenario Canvas. For a detailed example, see
Create a Driving Scenario. In this case, the draw
direction is the direction in which roads render in the Scenario
Canvas.
For a road with a top-to-bottom draw direction, the difference between the
x-coordinates of the first two consecutive road centers is
positive.
For a road with a bottom-to-top draw direction, the difference between the
x-coordinates of the first two consecutive road centers is
negative.
For a road with a left-to-right draw direction, the difference between the
y-coordinates of the first two consecutive road centers is
positive.
For a road with a right-to-left draw direction, the difference between the
y-coordinates of the first two consecutive road centers is
negative.
Numbering LanesLanes must be numbered from left to right, with the left edge of the road defined
relative to the draw direction of the road. For a one-way road, by default, the left edge of
the road is a solid yellow marking which indicates the end of the road in transverse
direction (direction perpendicular to draw direction). For a two-way road, by default, both
edges are marked with solid white lines.
For example, these diagrams show how the lanes are numbered in a one-way and two-way
road with a draw direction from top-to-bottom.
Numbering Lanes in a One-Way Road | Numbering Lanes in a Two-Way Road |
Specify the number of lanes as a positive integer for a one-way road. If
you set the integer value as 3 , then the road has three lanes
that travel in the same direction. The lanes are numbered starting from the left
edge of the road. 1, 2,
3 denote the first, second, and third lanes of the road,
respectively. | Specify the number of lanes as a two-element vector of positive integer
for a two-way road. If you set the vector as [1
2 ], then the road has three lanes: two lanes traveling in one
direction and one lane traveling in the opposite direction. Because of the draw
direction, the road has one left lane and two right lanes. The lanes are numbered
starting from the left edge of the road. 1L
denote the only left lane of the road. 1R and
2R denote the first and second right lanes of the road,
respectively. |
The lane specifications apply by the order in which the lanes are numbered.