Main Content

laneSpecConnector

Define road segment connector specifications

Since R2021a

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

lc = laneSpecConnector creates a road segment connector object to connect two road segments with different lane specifications. Specify road segment connector objects as inputs to a compositeLaneSpec object to create a road with multiple lane specifications.

example

lc = laneSpecConnector(Name,Value) sets properties using one or more name-value arguments. For example, '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.

example

Properties

expand all

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 NameEnumerated ValueDescriptionExample (Using Left-To-Right Road)
'Linear'0Current segment tapers linearly while adding or dropping lanes for the next segment.

Taper for Linear value

'None'1Segment does not taper, changing abruptly while adding or dropping lanes.

Taper for None value

Example: 'TaperShape','None'

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

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 NameEnumerated ValueDescriptionExample (Using Left-To-Right Road)
'Right'0Add or drop lanes from the right edge of the road.

Segment adding lane to right edge of road.

'Left'1Add or drop lanes from the left edge of the road.

Segment adding lane to left edge of road.

'Both'2Add or drop lanes from both edges of the road.

Segment adding lanes to both edges of 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], the compositeLaneSpec 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] and 2, the compositeLaneSpec object applies the 'Left' position. In contrast, if the lane specifications of two road segments are [1 2] and 1, the compositeLaneSpec 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 and TaperLength properties apply when either the number of lanes or the segment width changes between road segments. However, the Position property applies, only when adding or dropping lanes between road segments.

Example: 'Position','Both'

Examples

collapse all

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')

Figure contains an axes object. The axes object with title Road with Multiple Lane Specifications, xlabel X (m), ylabel Y (m) contains 3 objects of type patch, line.

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')

Figure contains an axes object. The axes object with title Lane Widening Along a Curve, xlabel X (m), ylabel Y (m) contains 4 objects of type patch, line. One or more of the lines displays its values using only markers

More About

expand all

Version History

Introduced in R2021a