Import ASAM OpenDRIVE Roads into Driving Scenario
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 import roads and lanes from an ASAM OpenDRIVE file into a driving scenario. You can then add actors and sensors to the scenario and generate synthetic lane and object detections for testing your driving algorithms developed in MATLAB®. Alternatively, to test driving algorithms developed in Simulink®, you can use a Scenario Reader block to read the road network and actors into a model.
The app supports importing road networks from OpenDRIVE® file versions 1.4 and 1.5, as well as ASAM OpenDRIVE file version 1.6.
To import ASAM OpenDRIVE roads and lanes into a
drivingScenario object instead of into the app, use
Import ASAM OpenDRIVE File
To import an ASAM OpenDRIVE file into the Driving Scenario Designer app, follow these steps:
Open the Driving Scenario Designer app. At the MATLAB command prompt, enter:
On the app toolstrip, click Import > ASAM OpenDRIVE File.
In the ASAM OpenDRIVE Import dialog box, browse for a valid ASAM OpenDRIVE file of type
In this example, you navigate to this file, where
is the root of your MATLAB folder:
You cannot import an ASAM OpenDRIVE road network into an existing driving scenario. If you attempt to do so, the app prompts you to save your existing scenario.
(Optional) If you do not want to see any errors or warnings that may occur during import, clear the Show errors and warnings parameter. By default, this parameter is selected.
Click Import. If you have selected the Show errors and warnings parameter, the Import ASAM OpenDRIVE Results dialog box displays any warnings and errors that occurr during import. You can copy these warnings and errors to a text file. Then, close the dialog box.
The Scenario Canvas of the app displays the imported road network.
As of R2021b, the ASAM OpenDRIVE import feature offers functional and visual improvements, as well as a few additional limitations.
You can now add new roads to a scenario and export a MATLAB function after importing an ASAM OpenDRIVE road network.
You can now import roads with multiple lane specifications.
Imported roads show boundary lines that were not shown previously.
Road centers always appear in the middle of imported roads. Previously, some roads were showing road centers on the road edges.
Junctions are represented using a
RoadGroupobject that combines road segments within a junction. Previously, each road segment within a junction was represented separately. As a result, imported road networks now use a smaller number of roads.
The road IDs, number of roads, junction IDs, and number of junctions in a driving scenario may not match those specified in the imported ASAM OpenDRIVE file.
The roads in the imported network are thousands of meters long. Use the mouse wheel to zoom in the road network and inspect it more closely. The road network contains a roundabout that connects six roads.
Verify that the road network imported as expected, keeping in mind the following limitations and behaviors within the app.
ASAM OpenDRIVE Import Limitations
The Driving Scenario Designer app does not support all components of the ASAM OpenDRIVE specification.
You can import only lanes, lane type information, and roads. The import of road objects and traffic signals is not supported.
ASAM OpenDRIVE files containing large road networks can take up to several minutes to load. In addition, these road networks can cause slow interactions on the app canvas. 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 app sets the lane width to 4 meters throughout.
When you import one-way roads with multiple lane specifications, the app supports only those segment taper positions that match the travel direction of lane. For example, the app supports importing only right taper position for the right lanes. Left or both types of taper position are not supported for right lanes.
Roads with lane type information specified as
parkingare supported. Lanes with any other lane type information are imported as border lanes.
Lane marking styles
Grassare not supported. Lanes with these marking styles are imported as unmarked.
In the Driving Scenario Designer app, the orientation of roads can differ from the orientation of roads in other tools that display ASAM OpenDRIVE roads. The table shows this difference in orientation between the app and the OpenDRIVE ODR Viewer.
|Driving Scenario Designer||OpenDRIVE ODR Viewer|
In the OpenDRIVE ODR viewer, the X-axis runs along the bottom of the viewer, and the Y-axis runs along the left side of the viewer.
In the Driving Scenario Designer app, the Y-axis runs along the bottom of the canvas, and the X-axis runs along the left side of the canvas. This world coordinate system in the app aligns with the vehicle coordinate system (XV,YV) used by vehicles in the driving scenario, where:
The XV-axis (longitudinal axis) points forward from a vehicle in the scenario.
The YV-axis (lateral axis) points to the left of the vehicle, as viewed when facing forward.
For more details about the coordinate systems, see Coordinate Systems in Automated Driving Toolbox.
Add Actors and Sensors to Scenario
You can add actors and sensors to a scenario containing ASAM OpenDRIVE roads.
Before adding an actor and sensors, if you have road interactions enabled, consider disabling them to prevent you from accidentally dragging road centers and changing the road network. If road interactions are enabled, in the bottom-left corner of the Scenario Canvas, click the Configure the Scenario Canvas button , and then clear Enable road interactions.
Add an ego vehicle to the scenario by right-clicking one of the roads in the canvas and selecting Add Car. To specify the trajectory of the car, right-click the car in the canvas, select Add Forward Waypoints (Ctrl+F), and add waypoints along the road for the car to pass through. After you add the last waypoint along the road, press Enter. The car autorotates in the direction of the first waypoint.
Add a camera sensor to the ego vehicle. On the app toolstrip, click Add Camera. Then, on the sensor canvas, add the camera to the predefined location representing the front window of the car.
Configure the camera to detect lanes. In the left pane, on the
Sensors tab, expand the Detection Parameters
section. Then, set the Detection Type parameter to
Generate Synthetic Detections
To generate lane detections from the camera, on the app toolstrip, click Run. As the scenario runs, the Ego-Centric View displays the scenario from the perspective of the ego vehicle. The Bird’s-Eye Plot displays the left-lane and right-lane boundaries of the ego vehicle.
To export a MATLAB function that generates the scenario and its detections, on the app toolstrip, click Export > MATLAB Function.
To export the detections to the MATLAB workspace, on the app toolstrip, click Export > Export Sensor Data. Name the workspace variable and click OK.
After you generate the detections, click Save to save the scenario file. In addition, you can save the sensor models as separate files. You can also save the road and actor models together as a separate scenario file.
You can reopen this scenario file from the app. Alternatively, at the MATLAB command prompt, you can use this syntax.
If you are developing a driving algorithm in Simulink, you can use a Scenario Reader
block to read the roads and actors from the
drivingScenario object or the
scenario file into your model. Scenario files containing large ASAM OpenDRIVE road networks can take up to several minutes to read into models. The
Scenario Reader block does not directly read sensor data. To add sensors
created in the app to a Simulink model, you can generate a model containing your scenario and sensors by
selecting Export > Simulink Model. In this model, a Scenario Reader block reads the scenario and
radar and vision sensor blocks model the sensors.
- Create Driving Scenario Interactively and Generate Synthetic Sensor Data
- Prebuilt Driving Scenarios in Driving Scenario Designer
- Coordinate Systems in Automated Driving Toolbox
- Scenario Generation from Recorded Vehicle Data
- Export Driving Scenario to ASAM OpenDRIVE File
- Export Driving Scenario to ASAM OpenSCENARIO File