Main Content

Export Driving Scenario to ASAM OpenDRIVE File

ASAM OpenDRIVE® 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 ASAM OpenDRIVE file. There may be variations between the original scenario and the exported scenario. For details, see Limitations.

The app supports exporting driving scenarios to OpenDRIVE® file versions V1.4, V1.5, and ASAM OpenDRIVE file version V1.6.

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.

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, click 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/toolbox/driving/drivingdata/LeftTurnScenario.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 ASAM OpenDRIVE file. For information about how to create a scenario, see Create Driving Scenario Interactively and Generate Synthetic Sensor Data.

Export to ASAM OpenDRIVE

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

Export menu for OpenDRIVE in DSD app

The app opens the OpenDRIVE Export dialog box. Specify file information using these options:

  • File Path — Specify a name for the output ASAM OpenDRIVE file with either the .xodr or .xml file extension. By default, the app saves the file in the current working directory. To specify a different file location, click Browse. If a file with the specified name already exists, the app overwrites the existing file.

  • File Version — Specify the file format version for the output file as Version 1.4 (default), Version 1.5, or Version 1.6.

  • Export Actors — Select this parameter to export actors to ASAM OpenDRIVE file. By default, this parameter is selected.

  • Show errors and warnings — Select this parameter to display errors and warnings that occur during export. By default, this parameter is selected.

Once you have specified the file information, click Export. If you have selected the Show errors and warnings parameter, the Export ASAM OpenDRIVE Results dialog box displays any warnings and errors that occur during export. You can copy these warnings and errors to a text file. Then, close the dialog box.

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 > ASAM OpenDRIVE File. Select the exported ASAM OpenDRIVE file and click Open. The app does not support importing actors specified in ASAM OpenDRIVE file. See Import ASAM OpenDRIVE Roads into Driving Scenario for more details.

Actual ScenarioExported Scenario

Actual scenario

Exported ODR scenario

Notice that the exported road network shows minor 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 ASAM OpenDRIVE format.

    Input RoadExported ASAM 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 ASAM OpenDRIVE Roads

    Input overlapping roads

    Exported roads

Lanes

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

    Input RoadExported ASAM 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 RoadsExported ASAM OpenDRIVE Roads

    Original junction

    Exported junction

  • When a junction is not connected to any road, the app does not export such junction.

    Input RoadsExported ASAM OpenDRIVE Roads

    Original road network

    Exported road network without junction

    To export a detached junction to an ASAM OpenDRIVE file, you can manually drag incoming or outgoing roads and attach them to the 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'.

ASAM OpenDRIVE Import

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

See Also

Apps

Objects

Functions

Related Topics

External Websites