laneSpecConnector
Description
The laneSpecConnector
object defines specifications for
connecting two road segments with different lane specifications. See compositeLaneSpec
for more details on creating a road with multiple lane specifications.
Creation
Description
creates a road
segment connector object to connect two road segments with different lane specifications.
Specify road segment connector objects as inputs to a lc
= laneSpecConnectorcompositeLaneSpec
object to create a road with multiple lane
specifications.
sets properties using one or more name-value arguments. For example,
lc
= laneSpecConnector(Name,Value
)'TaperLength',20
specifies a taper length of 20 meters. For more
information on the geometric properties of taper and road segments, see Composite Lane Specification.
Properties
TaperShape
— Shape of taper
'Linear'
(default) | 'None'
| character vector | string scalar
Shape of the taper connecting two road segments, specified as a character vector or
string scalar that partially or fully matches a ConnectorTaperShape
enumeration member name. While creating the object, specify this property as a character
vector or a string scalar that must partially or fully match one of these enumeration
member names.
Enumeration Member Name | Enumerated Value | Description | Example (Using Left-To-Right Road) |
'Linear' | 0 | Current segment tapers linearly while adding or dropping lanes for the next segment. |
|
'None' | 1 | Segment does not taper, changing abruptly while adding or dropping lanes. |
|
Example: 'TaperShape'
,'None'
TaperLength
— Length of taper
real positive scalar
Length of the taper connecting two road segments, specified as a real positive
scalar. Units are in meters. The default taper length is the smaller of
241
meters or 75
percent of the length of the
road segment containing the taper.
Note
Taper length must be less than the corresponding road segment length. Otherwise, the function resets it to a value that is
75
percent of the length of the corresponding road segment.Do not specify taper length when the taper shape is set to
'None'
. The function will ignore the specified input.
Example: 'TaperLength'
,20
Data Types: double
Position
— Road segment connector position
'Right'
(default) | 'Left'
| 'Both'
| character vector | string scalar
Road segment connector position, specified as a character vector or string scalar
that partially or fully matches a ConnectorPosition
enumeration
member name. This property specifies the edge of the road from which to add or drop
lanes. While creating the object, specify this property as a character vector or a
string scalar that must partially or fully match one of these enumeration member names.
Enumeration Member Name | Enumerated Value | Description | Example (Using Left-To-Right Road) |
'Right' | 0 | Add or drop lanes from the right edge of the road. |
|
'Left' | 1 | Add or drop lanes from the left edge of the road. |
|
'Both' | 2 | Add or drop lanes from both edges of the road. |
|
Use this property only when connecting two one-way road segments with different number of lanes. To add or drop lanes from both the edges of a one-way road, the number of lanes of the road segments must differ by an even number.
Do not specify this property when connecting road segments that are not one-way
because the compositeLaneSpec
object ignores this property.
To connect two-way road segments, the
compositeLaneSpec
object determines the connector position from the number of lanes defined by the corresponding lane specification objects. For example, if the number of lanes of two-way road segments are[1 1]
and[2 1]
, thecompositeLaneSpec
object applies the'Left'
position.To connect one-way and two-way road segments, the
compositeLaneSpec
object adds or drops the left (backward) lanes from the left edge of the road. The object applies the'Left'
position when the number of right (forward) lanes matches between both road segments. Otherwise, the connector position is set to'Both'
. For example, if the lane specifications of two road segments are[1 2]
and2
, thecompositeLaneSpec
object applies the'Left'
position. In contrast, if the lane specifications of two road segments are[1 2]
and1
, thecompositeLaneSpec
object sets the position property to'Both'
.
Note
A driving scenario considers all the lanes in a one-way road to be right (forward) lanes, which assumes that traffic flows in the same direction as the draw direction of the road. For more information about the draw direction of roads, see Draw Direction of Road and Numbering of Lanes.
The
TaperShape
andTaperLength
properties apply when either the number of lanes or the segment width changes between road segments. However, thePosition
property applies, only when adding or dropping lanes between road segments.
Example:
'Position'
,'Both'
Examples
Add Lane to One-Way Road
Create a road with multiple lane specifications and add one lane to the left of a one-way road.
Create a driving scenario. Specify the road centers for a straight, 100-meter road with draw direction from left-to-right.
scenario = drivingScenario; roadCenters = [20 100; 20 0];
Define an array of lane specifications for two one-way road segments. The first road segment has two lanes and the second road segment has three lanes.
lsArray = [lanespec(2) lanespec(3)];
Define a road segment connector object. To add the third lane to the left side of the second road segment, specify the position property. Specify a taper length less than the length of the first road segment. Both the road segments are 50 meters long since, by default, the total road length of 100 meters is divided equally between the specified road segments.
lc = laneSpecConnector('Position','Left','TaperLength',30);
Create a composite lane specification object.
clspec = compositeLaneSpec(lsArray,'Connector',lc);
Add a road to the driving scenario and display the road. The scenario renders the road segments in the draw direction of the road, from left-to-right.
road(scenario,roadCenters,'Lanes',clspec); plot(scenario) title('Road with Multiple Lane Specifications')
Vary Lane Width Along Curve
Create an empty driving scenario. Specify the road centers for a curved road.
scenario = drivingScenario; roadCenters = [-20 22; 0 22; 18.8 15.8; 22 0; 22 -20];
Define the lane specifications for three two-way road segments. Notice that all the road segments have the same number of lanes. However, the second road segment has a greater lane width (4.6 meters) to widen the road along the curve. The other two road segments have the default lane width of 3.6 meters.
lsArray = [lanespec([1 1]) lanespec([1 1],'Width',4.6) lanespec([1 1])];
Define normalized lengths for each road segment. Notice that the sum of normalized lengths is 1
, and the length of the vector matches the number of lane specification objects.
range = [0.25 0.65 0.1];
Create a road segment connector object. Since the same specifications apply to both segment connectors for the three road segments, create only one laneSpecConnector
object. Since you are neither adding nor dropping lanes, do not define the position property of the road segment connector.
lc = laneSpecConnector('TaperLength',14);
Create a composite lane specification object and add the road to the driving scenario.
clspec = compositeLaneSpec(lsArray,'Connector',lc,'SegmentRange',range); road(scenario,roadCenters,'Lanes',clspec);
Plot the driving scenario.
plot(scenario,'RoadCenters','on') title('Lane Widening Along a Curve')
More About
Draw Direction of Road and Numbering of Lanes
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.
|
|
Lanes 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 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 [ 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.
Composite Lane Specification
A composite lane specification consists of an array of two or more lane specifications for a single road. Each lane specification defines a road segment, which is a section of the road with independent geometric properties, normalized range, and taper.
Each road segment is a directed segment that moves toward the final road center, with the first segment beginning at the first road center, the second segment starting where the first ends, and so on. The range of each road segment is a normalized distance that specifies a proportion of the total length of the road. When a road segment adds or drops lanes from a previous segment, the preceding segment tapers along a specified distance to accommodate the change in number of lanes.
When you render a road with composite lane specifications, the road segments render in the draw direction of the road. For example, consider a one-way road with two road segments and a default normalized range of 0.5 for each road segment. The first road segment contains four lanes and the second segment contains only two lanes. The first segment tapers from four lanes to two lanes, dropping one lane from each side, as it approaches the halfway point of the road, which is the start point of the second segment. These diagrams show the direction in which the road segments render, and how the taper applies to the road, for both the left-to-right and right-to-left draw directions.
|
|
For information on the geometric properties of lanes, see Lane Specifications.
Version History
Introduced in R2021a
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)