Skip to content

Commit

Permalink
Add scenario example
Browse files Browse the repository at this point in the history
Signed-off-by: ClemensLinnhoff <[email protected]>
  • Loading branch information
ClemensLinnhoff committed Jan 30, 2025
1 parent 9006721 commit 6fb1628
Show file tree
Hide file tree
Showing 6 changed files with 267 additions and 0 deletions.
Binary file not shown.
26 changes: 26 additions & 0 deletions examples/scenario_example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Scenario example

This example showcases the interaction between ASAM OpenMATERIAL 3D, ASAM OpenDRIVE, ASAM OpenSCENARIO and ASAM OSI.

## ASAM OpenDRIVE

The `environment_example.xodr` is an OpenDRIVE file, that corresponds to the environment_example OpenMATERIAL 3D asset, also contained in the exmaples folder.
This means, that the environment example asset has the same coordinate frame as the corresponding OpenDRIVE file.
Furthermore, the road network geometry in the asset corresponds to the road network description of the OpenDRIVE.

## ASAM OpenSCENARIO

The `scenario_example_two_vehicles.xosc` is an OpenSCENARIO file.
It links the OpenDRIVE file described above as `LogicFile`.
It also links the corresponding OpenMATERIAL 3D asset as `SceneGraphFile`, so it can be associated with the stationary environment.
The moving entities are described in a separate vehicle catalog, which can be found in `catalogs/vehicles/VehicleCatalog.xosc`.
It contains one vehicle, that refers to the OpenMATERIAL 3D vehicle_example as `model3d`.

## ASAM OSI

To showcase the interaction with OSI, the OpenSCENARIO described above was played with the scenario player [esmini](https://github.com/esmini/esmini).
The output was stored in an ASAM OSI binary SensorView trace file, `20250130T100644Z_sv_370_2112_700_scenario_example_two_vehicles.osi`.
The OpenMATERIAL 3D assets linked in the OpenSCENARIO file and the OpenSCENARIO vehicle catalog are contained in the OSI trace file as model_references.
The screenshot below was taken with Persival Simspector to visualize the content of the OSI trace file including the referenced OpenMATERIAL 3D assets.

![scenario_example.png](scenario_example.png)
21 changes: 21 additions & 0 deletions examples/scenario_example/catalogs/vehicles/VehicleCatalog.xosc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<OpenSCENARIO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../OpenScenario.xsd">
<FileHeader description="DSC vehicle catalog" author="Blender Driving Scenario Creator" revMajor="1" revMinor="2" date="2024-08-07T10:38:04.276108"/>
<Catalog name="VehicleCatalog">
<Vehicle name="car_0" vehicleCategory="car" model3d="../vehicle_example/vehicle_example.xoma">
<BoundingBox>
<Center x="1.146" y="0.0" z="0.647"/>
<Dimensions width="1.618" length="3.854" height="1.296"/>
</BoundingBox>
<Performance maxSpeed="${250/3.6}" maxDeceleration="10" maxAcceleration="5"/>
<Axles>
<FrontAxle maxSteering="0.175" wheelDiameter="0.661" trackWidth="1.318" positionX="2.4" positionZ="0.33"/>
<RearAxle maxSteering="0.0" wheelDiameter="0.661" trackWidth="1.318" positionX="0" positionZ="0.33"/>
</Axles>
<Properties>
<Property name="model_id" value="2"/>
<Property name="scaleMode" value="ModelToBB"/>
</Properties>
</Vehicle>
</Catalog>
</OpenSCENARIO>
114 changes: 114 additions & 0 deletions examples/scenario_example/environment_example.xodr
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<OpenDRIVE>
<header name="blender_dsc" revMajor="1" revMinor="5" date="2024-08-07 10:38:04.329523" north="0.0" south="0.0" east="0.0" west="0.0"/>
<road rule="RHT" id="1" junction="-1" length="60.77312767066612">
<link>
<successor elementType="road" elementId="2" contactPoint="start"/>
</link>
<planView>
<geometry s="0" x="30.068370819091797" y="0.023977994918823242" hdg="-3.2267648860130294" length="60.77312767066612">
<line/>
</geometry>
</planView>
<elevationProfile>
<elevation s="0" a="0.0" b="0" c="0" d="0"/>
</elevationProfile>
<lateralProfile/>
<lanes>
<laneSection s="0">
<left>
<lane id="2" type="border" level="false">
<link>
<successor id="2"/>
</link>
<width a="0.20000000298023224" b="0.0" c="0.0" d="0.0" sOffset="0"/>
<roadMark sOffset="0" type="none" weight="standard" color="standard" height="0.02"/>
</lane>
<lane id="1" type="driving" level="false">
<link>
<successor id="1"/>
</link>
<width a="3.5" b="0.0" c="0.0" d="0.0" sOffset="0"/>
<roadMark sOffset="0" type="solid" weight="standard" color="white" height="0.02"/>
</lane>
</left>
<center>
<lane id="0" type="none" level="false">
<roadMark sOffset="0" type="broken" weight="standard" color="white" height="0.02"/>
</lane>
</center>
<right>
<lane id="-1" type="driving" level="false">
<link>
<successor id="-1"/>
</link>
<width a="3.5" b="0.0" c="0.0" d="0.0" sOffset="0"/>
<roadMark sOffset="0" type="solid" weight="standard" color="white" height="0.02"/>
</lane>
<lane id="-2" type="border" level="false">
<link>
<successor id="-2"/>
</link>
<width a="0.20000000298023224" b="0.0" c="0.0" d="0.0" sOffset="0"/>
<roadMark sOffset="0" type="none" weight="standard" color="standard" height="0.02"/>
</lane>
</right>
</laneSection>
</lanes>
</road>
<road rule="RHT" id="2" junction="-1" length="45.962855229770796">
<link>
<predecessor elementType="road" elementId="1" contactPoint="end"/>
</link>
<planView>
<geometry s="0" x="-30.484455108642578" y="5.193887233734131" hdg="-3.2267648860130294" length="45.962855229770796">
<arc curvature="0.009438562624500239"/>
</geometry>
</planView>
<elevationProfile>
<elevation s="0" a="0.0" b="0" c="0" d="0"/>
</elevationProfile>
<lateralProfile/>
<lanes>
<laneSection s="0">
<left>
<lane id="2" type="border" level="false">
<link>
<predecessor id="2"/>
</link>
<width a="0.20000000298023224" b="0.0" c="0.0" d="0.0" sOffset="0"/>
<roadMark sOffset="0" type="none" weight="standard" color="standard" height="0.02"/>
</lane>
<lane id="1" type="driving" level="false">
<link>
<predecessor id="1"/>
</link>
<width a="3.5" b="0.0" c="0.0" d="0.0" sOffset="0"/>
<roadMark sOffset="0" type="solid" weight="standard" color="white" height="0.02"/>
</lane>
</left>
<center>
<lane id="0" type="none" level="false">
<roadMark sOffset="0" type="broken" weight="standard" color="white" height="0.02"/>
</lane>
</center>
<right>
<lane id="-1" type="driving" level="false">
<link>
<predecessor id="-1"/>
</link>
<width a="3.5" b="0.0" c="0.0" d="0.0" sOffset="0"/>
<roadMark sOffset="0" type="solid" weight="standard" color="white" height="0.02"/>
</lane>
<lane id="-2" type="border" level="false">
<link>
<predecessor id="-2"/>
</link>
<width a="0.20000000298023224" b="0.0" c="0.0" d="0.0" sOffset="0"/>
<roadMark sOffset="0" type="none" weight="standard" color="standard" height="0.02"/>
</lane>
</right>
</laneSection>
</lanes>
</road>
</OpenDRIVE>
Binary file added examples/scenario_example/scenario_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
106 changes: 106 additions & 0 deletions examples/scenario_example/scenario_example_two_vehicles.xosc
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<OpenSCENARIO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="OpenScenario.xsd">
<FileHeader description="dsc_scenario" author="blender_dsc" revMajor="1" revMinor="2" date="2024-08-07T10:38:04.330385"/>
<CatalogLocations>
<VehicleCatalog>
<Directory path="catalogs/vehicles"/>
</VehicleCatalog>
</CatalogLocations>
<RoadNetwork>
<LogicFile filepath="environment_example.xodr"/>
<SceneGraphFile filepath="../environment_example/environment_example.xoma"/>
</RoadNetwork>
<Entities>
<ScenarioObject name="car_0">
<CatalogReference catalogName="VehicleCatalog" entryName="car_0"/>
</ScenarioObject>
<ScenarioObject name="car_1">
<CatalogReference catalogName="VehicleCatalog" entryName="car_0"/>
</ScenarioObject>
</Entities>
<Storyboard>
<Init>
<Actions>
<Private entityRef="car_0">
<PrivateAction>
<TeleportAction>
<Position>
<LanePosition roadId="1" laneId="-1" offset="0.0" s="3.0">
<Orientation type="relative" h="0.0" p="0.0" r="0" />
</LanePosition>
</Position>
</TeleportAction>
</PrivateAction>
<PrivateAction>
<LongitudinalAction>
<SpeedAction>
<SpeedActionDynamics dynamicsShape="step" value="1.0" dynamicsDimension="time"/>
<SpeedActionTarget>
<AbsoluteTargetSpeed value="14.0"/>
</SpeedActionTarget>
</SpeedAction>
</LongitudinalAction>
</PrivateAction>
<PrivateAction>
<LateralAction>
<LaneChangeAction>
<LaneChangeActionDynamics dynamicsShape="cubic" value="2.0" dynamicsDimension="rate"/>
<LaneChangeTarget>
<RelativeTargetLane value="1" entityRef="car_0"/>
</LaneChangeTarget>
</LaneChangeAction>
</LateralAction>
</PrivateAction>
</Private>
<Private entityRef="car_1">
<PrivateAction>
<TeleportAction>
<Position>
<WorldPosition x="9.603965759277344" y="-0.11001241207122803" z="0.0" h="3.0412473678588867"/>
</Position>
</TeleportAction>
</PrivateAction>
<PrivateAction>
<TeleportAction>
<Position>
<LanePosition roadId="1" laneId="-1" offset="0.0" s="15.0">
<Orientation type="relative" h="0.0" p="0.0" r="0" />
</LanePosition>
</Position>
</TeleportAction>
</PrivateAction>
<PrivateAction>
<LongitudinalAction>
<SpeedAction>
<SpeedActionDynamics dynamicsShape="step" value="1.0" dynamicsDimension="time"/>
<SpeedActionTarget>
<AbsoluteTargetSpeed value="12.0"/>
</SpeedActionTarget>
</SpeedAction>
</LongitudinalAction>
</PrivateAction>
<PrivateAction>
<LateralAction>
<LaneChangeAction>
<LaneChangeActionDynamics dynamicsShape="cubic" value="2.0" dynamicsDimension="rate"/>
<LaneChangeTarget>
<RelativeTargetLane value="0" entityRef="car_1"/>
</LaneChangeTarget>
</LaneChangeAction>
</LateralAction>
</PrivateAction>
</Private>
</Actions>
</Init>
<Story name="story_act_empty">
<Act name="act_empty">
<ManeuverGroup name="empty" maximumExecutionCount="1">
<Actors selectTriggeringEntities="false"/>
</ManeuverGroup>
<StartTrigger/>
<StopTrigger/>
</Act>
</Story>
<StopTrigger/>
</Storyboard>
</OpenSCENARIO>

0 comments on commit 6fb1628

Please sign in to comment.