Main Content

Export Driving Scenario to OpenDRIVE File

OpenDRIVE® [1] is an open file format that enables you to specify large and complex road networks. Using the Driving Scenario Designer app, you can export the roads, lanes, junctions, and actors in a driving scenario to an OpenDRIVE file. There may be variations between the original scenario and the exported scenario. For details, see Limitations.

To programmatically export the roads, lanes, junctions, and actors in a drivingScenario object to an OpenDRIVE file, use the export object function of the drivingScenario object.

The export file format conforms with OpenDRIVE format specification version 1.4H.

Load Scenario File

To open the Driving Scenario Designer app, enter this command at the MATLAB® command prompt:

drivingScenarioDesigner

To load a scenario file, on the app toolstrip, select Open > Scenario File. The file you select must be a valid driving scenario session file with the .mat file extension.

From your MATLAB root folder, navigate to and open this file:

matlabroot/examples/driving/data/StraightRoadScenario.mat

The Scenario Canvas tab displays the scenario.

Actual scenario

Note

You can also create a scenario by using the Driving Scenario Designer app, and then export the scenario to an OpenDRIVE file. For information about how to create a scenario, see Create Driving Scenario Interactively and Generate Synthetic Sensor Data.

Export to OpenDRIVE

To export the roads, lanes, and junctions in the scenario to an OpenDRIVE file, on the app toolstrip, select Export > OpenDRIVE File.

Export menu for OpenDRIVE in DSD app

The app opens the Export Scenario window. In this window, specify a name for the output OpenDRIVE file, and choose a file extension. The OpenDRIVE files have either .xodr or .xml file extension. Once you have specified a file name, click Save. If the specified file already exists, the app overwrites the existing file.

Export scenario window for saving the file

Inspect Exported Scenario

To inspect the exported scenario using the Driving Scenario Designer app, on the app toolstrip, select Import > OpenDRIVE File. Select the exported OpenDRIVE file and click Open. The app does not support importing actors specified in OpenDRIVE file. See Import OpenDRIVE Roads into Driving Scenario for more details.

Actual ScenarioExported Scenario

Actual scenario

Exported ODR scenario

Notice that the exported road network does not have boundary lines and there are variations at the road junction. For more information about the variations, see Limitations.

Limitations

Roads

  • The cubic polynomial and the parametric cubic polynomial geometry types in the scenario are exported as spiral geometry types. This causes some variations in the exported road geometry if the road is a curved road. For example, in the figure below, notice that the sharp corners in the input road became relatively smooth when exported to the OpenDRIVE format.

    Input RoadExported OpenDRIVE Road

    Original road

    Exported road

  • When segments of adjacent roads overlap with each other, the app does not export the overlapping segments of the roads.

    Input RoadsExported OpenDRIVE Roads

    Input overlapping roads

    Exported roads

Lanes

  • When a road with multiple lane specifications has any segment containing only one lane, the app does not export multiple lane specifications. Instead the specifications of the first road segment are applied to the entire road while exporting.

    Input RoadExported OpenDRIVE Road

    The first segment of the original road has only one lane.

    Original road with lane add

    The entire exported road has the same specification as the first segment of the input road.

    Exported road without lane add

  • When a road with multiple lane specifications contains a taper between two road segments, the app exports the road without taper.

    Input RoadExported OpenDRIVE Road

    Original road with taper

    Exported road without taper

  • When a road consisting of multiple segments is connected to a junction, the app does not export the road.

Junctions

  • The junctions of the road network are processed without lane connection information, so the junction shapes may not be accurate in the exported scenario.

    Input RoadExported OpenDRIVE Road

    Original junction

    Exported junction

Actors

  • The app does not export any actor that is present either on a junction or on a road with multiple road segments.

  • While exporting a user-defined actor, the app sets the type of object to 'none'.

OpenDRIVE Import

  • When you export a driving scenario object that contains an imported OpenDRIVE scenario, the limitations of OpenDRIVE import apply to OpenDRIVE export. For information on the limitations of OpenDRIVE import, see Import OpenDRIVE Roads into Driving Scenario.

See Also

Apps

Objects

Functions

Related Topics

External Websites