export driving scenario to asam openscenario file
asam openscenario® is an open file format that describes the dynamic content of driving scenarios. using the driving scenario designer app, you can export road networks, actors, and trajectories from a driving scenario to an asam openscenario file.
the app supports exporting driving scenarios to asam openscenario file versions 1.0 and 1.1.
to programmatically export a driving scenario to an asam openscenario file, use the object function of the object.
load scenario file
to open the driving scenario designer app, enter this command at the matlab® command prompt:
drivingscenariodesigner
to load an existing 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. alternatively, you can create a new scenario
by using the driving scenario
designer app, and then export that scenario to an asam openscenario file. for information about how to create a scenario, see .
navigate to and open this driving scenario, where
matlabroot
is your matlab root folder:
matlabroot/toolbox/driving/drivingdata/cutinscenario.mat
the scenario canvas pane displays the scenario, in which an ego vehicle and a target vehicle travel on a straight road with predefined trajectories such that the target vehicle cuts into the ego lane.
this scenario contains these asam openscenario actions:
speedaction
— the ego vehicle travels with an initial speed of 15 m/s and then stops momentarily when it reaches a specified waypoint. the ego vehicle then travels at a speed of 10 m/s until the end of the scenario.visibilityaction
— the target vehicle enters the scenario after 3 seconds.followtrajectoryaction
— the vehicles explicitly follow their trajectories, specified using waypoints.
run the scenario and observe the behaviors of the two vehicles.
export to asam openscenario
to export the road network, actors, and trajectories in the scenario to an asam openscenario file, on the app toolstrip, select export > asam openscenario file.
the app opens the asam openscenario export dialog box.
on the openscenario tab, specify these options:
file path — specifies a name and location for the output asam openscenario file with either the
.xosc
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 — specifies the asam openscenario version for the output file as
version 1.0
orversion 1.1
.default:
version 1.0
on the opendrive tab, specify information for the associated asam opendrive® file using these options:
file version — specifies the asam opendrive version for the output file as
version 1.4
,version 1.5
, orversion 1.6
.default:
version 1.4
export actors — select this parameter to export actors to the asam opendrive file.
default:
on
once you have specified the file information, click
export. the app creates an asam openscenario file, which describes the dynamic behaviors of actors in the scenario, as
well as additional data files. each data file contains information about a specific
scenario element, such as a vehicle or pedestrian. the name of each data file has the
prefix filename
_, where filename
is the name specified using the file path option.
data file | element of scenario |
---|---|
filename _opendrive.xodr | road network and barriers in the scenario |
filename _vehiclecatalog.xosc | properties of vehicles |
filename _pedestriancatalog.xosc | properties of pedestrians |
note
the app exports data files based on the contents of the scenario. for example, if
the scenario does not contain any pedestrians, then the data file
filename
_pedestriancatalog.xosc
is
not exported.
asam openscenario representations
the exported files contain representations of driving scenario actors and their parameters in the asam openscenario format.
name, class, and actor properties
the app exports the name, class, and
actor properties for each actor to a
vehicle
element within the
filename
_vehiclecatalog
file.
asam openscenario vehicles include parameters without equivalent actor characteristics. this table shows the default values for those asam openscenario parameters for various types of exported actors.
vehicle parameter | default value in exported file | ||
---|---|---|---|
car | truck | bicycle | |
maxacceleration | 5.3645 m/s2 | 0.897 m/s2 | 0.231 m/s2 |
maxdeceleration | 6 m/s2 | 0.474 m/s2 | 7 m/s2 |
maxspeed | 39 m/s | 30 m/s | 22 m/s |
maxsteering | 0.5 rad | 0.5 rad | 0.61 rad |
trackwidth | width of vehicle | width of vehicle | 0 |
wheeldiameter | 0.381 m | 0.5715 m | 0.571 m |
this table describes how each attribute in the exported file maps to the actor properties in the app.
exported attribute in asam openscenario | conversion from actor properties |
---|---|
x -coordinate of center of bounding
box | x -coordinate of actor
position
rearoverhang 0.5 *
length |
y -coordinate of center of bounding
box | y -coordinate of actor
position |
z -coordinate of center of bounding
box | z -coordinate of actor
position |
positionx of front axle | x -coordinate of actor
position
frontoverhang –
rearoverhang
length |
positionz of front axle | 0.5 * wheeldiameter |
positionx of rear axle | x -coordinate of actor
position |
positionz of rear axle | 0.5 * wheeldiameter |
waypoints
the app exports the waypoints of an actor to the trajectory
element of the followtrajectoryaction
in the
init
section of the output asam openscenario file. the trajectory
element defines the motion of
the associated vehicle in the world position format using a polyline. setting
trajectoryfollowingmode
to position
forces
the actor to strictly adhere to the specified trajectory. exported trajectories do
not include a time
dimension.
note
the app interpolates additional waypoints between the ones specified in the driving scenario, to generate smooth trajectories for exported actors in the output asam openscenario file.
the app does not support exporting reverse waypoints of actors to an asam openscenario file.
speed
when the speed of a vehicle changes in the scenario, the app exports this
information to a speedaction
element in the output asam openscenario file. the app exports speed changes as a constant rate of change
toward a target speed by setting the dynamicsdimension
and
dynamicsshape
attributes of the
speedactiondynamics
element to rate
and
linear
,
respectively.
wait time
when an actor in a driving scenario uses the wait (s)
parameter, the app exports this information using the delay
attribute of the condition
element that triggers the event that
executes the next speedaction
.
in this sample code, the ego vehicle stops at the specified waypoint for 0.5
seconds and then continues traveling forward. the event
ds_event_ego4
specifies that the ego vehicle comes to a rest
position. the code represents the wait time information using the
delay
attribute of the ds_cond5
condition,
which triggers the event after ds_event_ego4
. as a result, the
ego vehicle waits for 0.5 seconds after coming to rest before it begins moving
again.
actor spawn and despawn
when you enable the actor spawn and despawn parameter, with
valid values for the entry time (s) and exit time
(s) parameters, the app exports this information using the
visibilityaction
element.
limitations
the driving scenario designer app does not support all components of the asam openscenario specification. this table shows the list of supported elements and attributes.
supported element or attribute |
---|
absolutetargetspeed |
act |
action |
actors |
axle |
axles |
boundingbox |
byentitycondition |
byvaluecondition |
catalogreference |
center |
clothoid |
condition |
conditiongroup |
dimensions |
directory |
entities |
entitycondition |
entityobject |
entityref |
event |
file |
fileheader |
followtrajectoryaction |
init |
longitudinalaction |
maneuver |
maneuvergroup |
miscobject |
openscenario |
pedestrian |
performance |
polyline |
position |
private |
privateaction |
reachpositioncondition |
roadnetwork |
route |
routingaction |
scenarioobject |
shape |
simulationtimecondition |
speedaction |
speedactiontarget |
story |
storyboard |
storyboardelementstatecondition |
teleportaction |
trajectory |
trigger |
triggeringentities |
vehicle |
vehiclecataloglocation |
vertex |
visibilityaction |
waypoint |
worldposition |
see also
apps
objects
functions
- |