Since R2021a

example

## Examples

collapse all

A three-way intersection is a Y-Junction in which two adjacent roads intersect the third road at an obtuse angle, as shown in this figure. To connect the three roads, you will create a Y-Junction by adding three road segments.

Create an empty driving scenario.

scenario = drivingScenario;

Specify the number of lanes and the width of each lane in the roads.

ls = lanespec(2,'Width',5);

Define the road centers for three roads and add them to the driving scenario. The first road is diagonally oriented to the left of the scenario canvas, second road is diagonally oriented to the right of the scenario canvas, and the third road is oriented vertically.

roadCenters = [-20 0; 6 0];

roadCenters = [23 7; 50 33];

roadCenters = [23 -7; 50 -33];

Plot the scenario.

figure
plot(scenario)

Create a RoadGroup object. Specify the width for each road segment that forms the Y-junction.

roadCenters = [23 7; 14 1; 6 0];

roadCenters = [23 -7; 14 -1; 6 0];

roadCenters = [23 7; 21 4; 21 -4; 23 -7];

## Input Arguments

collapse all

Driving scenario, specified as a drivingScenario object.

Note

## Limitations

• The function does not support lane markings in intersections.

• The scenario plot does not display the road centers in the intersection.

## Tips

• To create a smooth surface shape in an intersection, you must match the specifications (road centers, width, elevation and banking angle) of the road segments in the RoadGroup object to those of the incoming roads meeting at the intersection.

• The function considers only the first lane specification for each road segment while creating an intersection, so specify only a single lane specification for each road segment of the RoadGroup object.

## Version History

Introduced in R2021a