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 and lanes in a driving scenario to an OpenDRIVE file.
To programmatically export the roads, lanes, and junctions 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.
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.
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.
To export the roads, lanes, and junctions in the scenario to an OpenDRIVE file, on the app toolstrip, select Export > OpenDRIVE File.
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.
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.
Actual Scenario | Exported 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 export
.