roadNetwork

Add road network to driving scenario

Description

example

roadNetwork(scenario,'OpenDRIVE',filePath) imports roads and lanes from an OpenDRIVE® road network file into a driving scenario. This function supports OpenDRIVE format specification version 1.4H [1].

roadNetwork(___,'ShowLaneTypes',lanetype) uses the name-value pair 'ShowLaneTypes' to specify importing lane type information from an OpenDRIVE road network file and render into the driving scenario.

Examples

collapse all

Create an empty driving scenario.

scenario = drivingScenario;

Import an OpenDRIVE road network into the scenario.

filePath = fullfile(matlabroot,'examples','driving','intersection.xodr');  
roadNetwork(scenario,'OpenDRIVE',filePath);

Plot the scenario and zoom in on the road network by setting the axes limits.

plot(scenario)
xlim([350 800])
ylim([1400 2000])
zlim([0.00 10.00])

Create an empty driving scenario.

scenario = drivingScenario;

Import an OpenDRIVE road composed of driving and parking lanes into the scenario. By default, the function interprets the lane type information and imports the lanes into driving scenario without altering the lane type.

filePath = 'parking.xodr';  
roadNetwork(scenario,'OpenDRIVE',filePath);

Plot the scenario.

plot(scenario)
zoom(2)
legend('Driving lane','Parking lane')

Import the OpenDRIVE road into the scenario. Set the 'ShowLaneTypes' value to false to suppress multiple lane types. The function ignores the lane type information and imports all the lanes as driving lanes.

scenario = drivingScenario;
roadNetwork(scenario,'OpenDRIVE',filePath,'ShowLaneTypes',false);
plot(scenario)
zoom(2)

Input Arguments

collapse all

Driving scenario, specified as a drivingScenario object. scenario must contain no roads and no other OpenDRIVE road network.

Path to a valid OpenDRIVE file of type .xml or .xodr, specified as a character vector or string scalar.

Example: 'OpenDRIVE','C:\Desktop\myRoadNetwork.xodr'

Import lane type information, specified as a comma-separated pair consisting of 'ShowLaneTypes' and one of these values

  • true or 1 - To import lane type information from an OpenDRIVE road network file into the driving scenario and render lane types.

  • false or 0 - To ignore lane type information and import all lanes as driving lanes in the driving scenario.

The default value is true. The function can import only the lane types listed in this table into the driving scenario. The table summarizes the supported lane types and their default appearance on importing into the driving scenario.

Supported Lane TypesDescriptionDefault Appearance
Driving lanesLanes for driving

Border lanesLanes at the road borders

Restricted lanesLanes reserved for high-occupancy vehicles

Shoulder lanesLanes reserved for emergency stopping

Parking lanesLanes alongside driving lanes, intended for parking vehicles

Any other unsupported lane types are rendered as border lanes.

Example: 'ShowLaneTypes',false

Limitations

  • You can import only lanes, lane type information, and roads. The import of road objects and traffic signals is not supported.

  • OpenDRIVE files containing large road networks can take up to several minutes to load. Examples of large road networks include ones that model the roads of a city or ones with roads that are thousands of meters long.

  • Lanes with variable widths are not supported. The width is set to the highest width found within that lane. For example, if a lane has a width that varies from 2 meters to 4 meters, the function sets the lane width to 4 meters throughout.

  • Roads with lane type information specified as driving, border, restricted, shoulder, and parking are supported. Lanes with any other lane type information are imported as border lanes.

  • Roads with multiple lane marking styles are not supported. The function applies the first found marking style to all lanes in the road. For example, if a road has Dashed and Solid lane markings, the function applies Dashed lane markings throughout.

  • Lane marking styles Bott Dots, Curbs, and Grass are not supported. Lanes with these marking styles are imported as unmarked.

References

[1] Dupuis, Marius, et al. OpenDRIVE Format Specification. Revision 1.4, Issue H, Document No. VI2014.106. Bad Aibling, Germany: VIRES Simulationstechnologie GmbH, November 4, 2015.

Introduced in R2018b