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 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 object instead of into the app, use the function.
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:
drivingscenariodesigner
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
.xodr
or.xml
.in this example, you navigate to this file, where
is the root of your matlab folder:matlabroot
matlabroot/toolbox/shared/drivingscenario/roundabout.xodr
note
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.
note
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 object 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.
inspect roads
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
driving
,border
,restricted
,shoulder
, andparking
are supported. lanes with any other lane type information are imported as border lanes.lane marking styles
bott dots
,curbs
, andgrass
are not supported. lanes with these marking styles are imported as unmarked.
road orientation
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 .
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
lanes
.
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.
save scenario
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.
drivingscenariodesigner(scenariofilename)
if you are developing a driving algorithm in simulink, you can use a
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.