## Create Roads with Multiple Lane Specifications Using Driving Scenario Designer

This example shows how to interactively create roads with multiple lane specifications using the Driving Scenario Designer app. You can add or drop lanes along a road by defining multiple lane specifications for that road.

This example shows the workflow to create a road with a special passing lane. The passing lane enables slower vehicles to move into the right lane so that faster vehicles can pass uninterrupted in the left lane.

You can also define multiple lane specifications programmatically. For more information, see `compositeLaneSpec`.

### Open Driving Scenario Designer

To open the app, at the MATLAB® command prompt, enter `drivingScenarioDesigner`.

Add a straight road to the scenario canvas. On the app toolstrip, select . Then, click at the bottom-center of the canvas, extend the road to the top-center, and double-click the canvas to create the road. To specify precise coordinates for road centers, in the left pane, on the Roads tab, expand the Road Centers section and enter the values for x-axis and y-axis positions shown in this table.

1`0``0`
2`100``0`

### Define Multiple Lane Specifications

By default, the road is a single-segment, single-lane road without lane markings. To define multiple lane specifications, split the road into the desired number of road segments and specify different lane specifications for each road segment. The order for numbering the lanes and segments of a road depends on the orientation of the road. For more details, see Draw Direction of Road and Numbering of Lanes and Composite Lane Specification.

In the left pane, on the Roads tab, set the Number of Road Segments to `3`. By default, the length of the road is divided equally into the specified number of road segments. You can edit the lengths of road segments using the Segment Range parameter that denotes the normalized range for each road segment. Set the Segment Range parameter to ```[0.4 0.3 0.3]```.

#### Specify Lane Information for Each Road Segment

To define lane specifications for each road segment, from the Road Segment list, select the desired segment. Then, expand the Lanes section and set the Number of lanes and the Lane Width (m) parameters as shown in this table.

Road SegmentNumber of LanesLane Width (m)
`Segment 1 (range = 40% )``[1 1]``4`
`Segment 2 (range = 30% )``[1 2]``4`
`Segment 3 (range = 30% )``[1 1]``4`

This image shows the road after specifying the lane information.

You can inspect or modify the Lane Types and Lane Markings parameters for the lanes in the selected road segment. This example uses default values for these parameters.

#### Define Connection Between Road Segments

By default, road segments do not have taper when you add or drop lanes along the road. To make the scenario more realistic, specify information for the lanes to taper linearly when adding or dropping lanes between road segments.

Expand the Segment Taper section, select ```Taper 1``` from the list, and set these parameters:

• Shape`Linear`

• Length (m)`15`

Select `Taper 2` from the list and specify the same values for its corresponding parameters.

Note

For two-way road segments, the app determines the position from which to add or drop lanes based on the specified Number of Lanes parameter. When you create multiple lane specifications for a one-way road, the Segment Taper section additionally contains the Position parameter. Using this parameter, you can specify the edge of the road segment from which to add or drop lanes.

This image shows the road after specifying segment taper information.

### Next Steps

This example showed how to create a road with multiple lane specifications using the Driving Scenario Designer app. You can add actors and trajectories to the scenario. You can also add sensors and generate synthetic detections. For more information, see Create Driving Scenario Interactively and Generate Synthetic Sensor Data.

To export a road network to an ASAM OpenDRIVE® file, see Export Driving Scenario to ASAM OpenDRIVE File.