Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting several additional OpenScenario 1.0 tags #1014

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
* SignalizedJunctionLeftTurn has been remade. It now has an actor flow on which the ego has to merge into, instead of a single vehicle.
* The BackgroundActivity has been readded to the routes, which the objective of creating the sensation of traffic around the ego
* Add waypoint reached threshold so that the precision of the actor reaching to waypoints can be adjusted based on object types.
* **Supported OpenSCENARIO 2.0 standard.**
* OpenSCENARIO support:
- Added both init and story support for `EntityAction`
- Added story support for `TrafficSignalControllerAction`
- Added both init and story support for `LateralDistanceAction`
- Added support for `TrafficSignalControllerCondition`
* Supported OpenSCENARIO 2.0 standard.

### :bug: Bug Fixes
* Fixed bug at OtherLeadingVehicle scenario causing the vehicles to move faster than intended
Expand Down
8 changes: 4 additions & 4 deletions Docs/openscenario_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ contains of submodules, which are not listed, the support status applies to all

| GlobalAction | Init support | Story support | Notes |
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
| `EntityAction` | ❌ | ❌ | |
| `EntityAction` | ✅ | ✅ | |
| `EnvironmentAction` | ✅ | ❌ | |
| `ParameterAction` | ✅ | ✅ | |
| `InfrastructureAction` `TrafficSignalAction`<br>`TrafficAction` | &#10060; | &#10060; | |
| `InfrastructureAction` `TrafficSignalAction`<br>`TrafficSignalControllerAction` | &#10060; | &#10060; | |
| `InfrastructureAction` `TrafficSignalAction`<br>`TrafficSignalControllerAction` | &#10060; | &#9989; | |
| `InfrastructureAction` `TrafficSignalAction`<br>`TrafficSignalStateAction` | &#10060; | &#9989; | As traffic signals in CARLA towns have no unique ID, they have to be set by providing their position (Example: TrafficSignalStateAction name="pos=x,y" state="green"). The id can also be used for none CARLA town (Example: TrafficSignalStateAction name="id=n" state="green") |

<br>
Expand All @@ -98,7 +98,7 @@ contains of submodules, which are not listed, the support status applies to all
| `ControllerAction` | &#9989; | &#9989; | AssignControllerAction is supported, but a Python module has to be provided for the controller implementation, and in OverrideControllerValueAction all values need to be `False`. |
| `LateralAction`<br> `LaneChangeAction` | &#10060; | &#9989; | Currently all lane changes have a linear dynamicShape, the dynamicDimension is defined as the distance and are relative to the actor itself (RelativeTargetLane). |
| `LateralAction`<br>`LaneOffsetAction` | &#10060; | &#9989; | Currently all type of dynamicShapes are ignored and depend on the controller. This action might not work as intended if the offset is high enough to make the vehicle exit its lane |
| `LateralAction`<br> `LateralDistanceAction` | &#10060; | &#10060; | |
| `LateralAction`<br> `LateralDistanceAction` | &#9989; | &#9989; | |
| `LongitudinalAction`<br> `LongitudinalDistanceAction`| &#10060; | &#9989; |`timeGap` attribute is not supported |
| `LongitudinalAction`<br> `SpeedAction` | &#9989; | &#9989; | |
| `SynchronizeAction` | &#10060; | &#10060; | |
Expand Down Expand Up @@ -149,7 +149,7 @@ The following two tables list the support status for each.
| `StoryboardElementStateCondition` | &#9989; | startTransition, stopTransition, endTransition and completeState are currently supported. |
| `TimeOfDayCondition` | &#9989; | |
| `TrafficSignalCondition` | &#9989; | As traffic signals in CARLA towns have no unique ID, they have to be set by providing their position (Example: TrafficSignalCondition name="pos=x,y" state="green"). The id can also be used for none CARLA town (Example: TrafficSignalCondition name="id=n" state="green") |
| `TrafficSignalControllerCondition` | &#10060; | |
| `TrafficSignalControllerCondition` | &#9989; | |
| `UserDefinedValueCondition` | &#10060; | |

<br>
Expand Down
294 changes: 294 additions & 0 deletions srunner/examples/InitAddEntityAction.xosc
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
<?xml version="1.0" encoding="UTF-8"?>
<OpenSCENARIO>
<FileHeader revMajor="1" revMinor="0" date="2020-03-20T12:00:00" description="CARLA:FollowLeadingVehicle" author=""/>
<ParameterDeclarations>
<ParameterDeclaration name="leadingSpeed" parameterType="double" value="5.0"/>
</ParameterDeclarations>
<CatalogLocations/>
<RoadNetwork>
<LogicFile filepath="Town01"/>
<SceneGraphFile filepath=""/>
</RoadNetwork>
<Entities>
<ScenarioObject name="hero">
<Vehicle name="vehicle.lincoln.mkz_2017" vehicleCategory="car">
<ParameterDeclarations/>
<Performance maxSpeed="69.444" maxAcceleration="200" maxDeceleration="10.0"/>
<BoundingBox>
<Center x="1.5" y="0.0" z="0.9"/>
<Dimensions width="2.1" length="4.5" height="1.8"/>
</BoundingBox>
<Axles>
<FrontAxle maxSteering="0.5" wheelDiameter="0.6" trackWidth="1.8" positionX="3.1" positionZ="0.3"/>
<RearAxle maxSteering="0.0" wheelDiameter="0.6" trackWidth="1.8" positionX="0.0" positionZ="0.3"/>
</Axles>
<Properties>
<Property name="type" value="ego_vehicle"/>
<Property name="color" value="0,0,255"/>
</Properties>
</Vehicle>
</ScenarioObject>
<ScenarioObject name="adversary">
<Vehicle name="vehicle.tesla.model3" vehicleCategory="car">
<ParameterDeclarations/>
<Performance maxSpeed="69.444" maxAcceleration="200" maxDeceleration="10.0"/>
<BoundingBox>
<Center x="1.5" y="0.0" z="0.9"/>
<Dimensions width="2.1" length="4.5" height="1.8"/>
</BoundingBox>
<Axles>
<FrontAxle maxSteering="0.5" wheelDiameter="0.6" trackWidth="1.8" positionX="3.1" positionZ="0.3"/>
<RearAxle maxSteering="0.0" wheelDiameter="0.6" trackWidth="1.8" positionX="0.0" positionZ="0.3"/>
</Axles>
<Properties>
<Property name="type" value="simulation"/>
<Property name="color" value="255,0,0"/>
</Properties>
</Vehicle>
</ScenarioObject>
<ScenarioObject name="adversary2">
<Vehicle name="vehicle.tesla.model3" vehicleCategory="car">
<ParameterDeclarations/>
<Performance maxSpeed="69.444" maxAcceleration="200" maxDeceleration="10.0"/>
<BoundingBox>
<Center x="1.5" y="0.0" z="0.9"/>
<Dimensions width="2.1" length="4.5" height="1.8"/>
</BoundingBox>
<Axles>
<FrontAxle maxSteering="0.5" wheelDiameter="0.6" trackWidth="1.8" positionX="3.1" positionZ="0.3"/>
<RearAxle maxSteering="0.0" wheelDiameter="0.6" trackWidth="1.8" positionX="0.0" positionZ="0.3"/>
</Axles>
<Properties>
<Property name="type" value="simulation"/>
<Property name="color" value="255,0,0"/>
</Properties>
</Vehicle>
</ScenarioObject>
<ScenarioObject name="adversary3">
<Vehicle name="vehicle.tesla.model3" vehicleCategory="car">
<ParameterDeclarations/>
<Performance maxSpeed="69.444" maxAcceleration="200" maxDeceleration="10.0"/>
<BoundingBox>
<Center x="1.5" y="0.0" z="0.9"/>
<Dimensions width="2.1" length="4.5" height="1.8"/>
</BoundingBox>
<Axles>
<FrontAxle maxSteering="0.5" wheelDiameter="0.6" trackWidth="1.8" positionX="3.1" positionZ="0.3"/>
<RearAxle maxSteering="0.0" wheelDiameter="0.6" trackWidth="1.8" positionX="0.0" positionZ="0.3"/>
</Axles>
<Properties>
<Property name="type" value="simulation"/>
<Property name="color" value="255,0,0"/>
</Properties>
</Vehicle>
</ScenarioObject>
</Entities>
<Storyboard>
<Init>
<Actions>
<GlobalAction>
<EnvironmentAction>
<Environment name="Environment1">
<TimeOfDay animation="false" dateTime="2020-03-20T12:00:00"/>
<Weather cloudState="free">
<Sun intensity="0.85" azimuth="0" elevation="1.31"/>
<Fog visualRange="100000.0"/>
<Precipitation precipitationType="dry" intensity="0.0"/>
</Weather>
<RoadCondition frictionScaleFactor="1.0"/>
</Environment>
</EnvironmentAction>
</GlobalAction>
<GlobalAction>
<EntityAction entityRef="adversary2">
<AddEntityAction>
<Position>
<RelativeRoadPosition entityRef="hero" ds="120" dt="-1.0"/>
</Position>
</AddEntityAction>
</EntityAction>
</GlobalAction>
<GlobalAction>
<EntityAction entityRef="adversary3">
<AddEntityAction>
<Position>
<RelativeRoadPosition entityRef="adversary2" ds="30" dt="0.0"/>
</Position>
</AddEntityAction>
</EntityAction>
</GlobalAction>
<Private entityRef="hero">
<PrivateAction>
<TeleportAction>
<Position>
<RoadPosition roadId="4" s="48.58" t="2.75"/>
</Position>
</TeleportAction>
</PrivateAction>
<PrivateAction>
<ControllerAction>
<AssignControllerAction>
<Controller name="HeroAgent">
<Properties>
<Property name="module" value="external_control"/>
</Properties>
</Controller>
</AssignControllerAction>
<OverrideControllerValueAction>
<Throttle value="0" active="false"/>
<Brake value="0" active="false"/>
<Clutch value="0" active="false"/>
<ParkingBrake value="0" active="false"/>
<SteeringWheel value="0" active="false"/>
<Gear number="0" active="false"/>
</OverrideControllerValueAction>
</ControllerAction>
</PrivateAction>
</Private>
<Private entityRef="adversary">
<PrivateAction>
<TeleportAction>
<Position>
<RelativeRoadPosition entityRef="hero" ds="50" dt="-1.0"/>
</Position>
</TeleportAction>
</PrivateAction>
</Private>
</Actions>
</Init>
<Story name="MyStory">
<Act name="Behavior">
<ManeuverGroup name="ManeuverSequence" maximumExecutionCount="1">
<Actors selectTriggeringEntities="false">
<EntityRef entityRef="adversary"/>
</Actors>
<Maneuver name="FollowLeadingVehicleManeuver">
<Event name="LeadingVehicleKeepsVelocity" priority="overwrite">
<Action name="LeadingVehicleKeepsVelocity">
<PrivateAction>
<LongitudinalAction>
<SpeedAction>
<SpeedActionDynamics dynamicsShape="step" value="50" dynamicsDimension="distance"/>
<SpeedActionTarget>
<AbsoluteTargetSpeed value="$leadingSpeed"/>
</SpeedActionTarget>
</SpeedAction>
</LongitudinalAction>
</PrivateAction>
</Action>
<StartTrigger>
<ConditionGroup>
<Condition name="StartConditionLeadingVehicleKeepsVelocity" delay="0" conditionEdge="rising">
<ByEntityCondition>
<TriggeringEntities triggeringEntitiesRule="any">
<EntityRef entityRef="hero"/>
</TriggeringEntities>
<EntityCondition>
<RelativeDistanceCondition entityRef="adversary" relativeDistanceType="longitudinal" value="20.0" freespace="true" rule="lessThan"/>
</EntityCondition>
</ByEntityCondition>
</Condition>
</ConditionGroup>
</StartTrigger>
</Event>
<Event name="LeadingVehicleWaits" priority="overwrite">
<Action name="LeadingVehicleWaits">
<PrivateAction>
<LongitudinalAction>
<SpeedAction>
<SpeedActionDynamics dynamicsShape="step" value="10" dynamicsDimension="time"/>
<SpeedActionTarget>
<AbsoluteTargetSpeed value="0.0"/>
</SpeedActionTarget>
</SpeedAction>
</LongitudinalAction>
</PrivateAction>
</Action>
<StartTrigger>
<ConditionGroup>
<Condition name="AfterLeadingVehicleKeepsVelocity" delay="0" conditionEdge="rising">
<ByValueCondition>
<StoryboardElementStateCondition storyboardElementType="action" storyboardElementRef="LeadingVehicleKeepsVelocity" state="endTransition"/>
</ByValueCondition>
</Condition>
</ConditionGroup>
</StartTrigger>
</Event>
</Maneuver>
</ManeuverGroup>
<StartTrigger>
<ConditionGroup>
<Condition name="OverallStartCondition" delay="0" conditionEdge="rising">
<ByEntityCondition>
<TriggeringEntities triggeringEntitiesRule="any">
<EntityRef entityRef="hero"/>
</TriggeringEntities>
<EntityCondition>
<TraveledDistanceCondition value="1.0"/>
</EntityCondition>
</ByEntityCondition>
</Condition>
<Condition name="StartTime" delay="0" conditionEdge="rising">
<ByValueCondition>
<SimulationTimeCondition value="0" rule="greaterThan"/>
</ByValueCondition>
</Condition>
</ConditionGroup>
</StartTrigger>
<StopTrigger>
<ConditionGroup>
<Condition name="EndCondition" delay="0" conditionEdge="rising">
<ByEntityCondition>
<TriggeringEntities triggeringEntitiesRule="any">
<EntityRef entityRef="hero"/>
</TriggeringEntities>
<EntityCondition>
<TraveledDistanceCondition value="200.0"/>
</EntityCondition>
</ByEntityCondition>
</Condition>
</ConditionGroup>
</StopTrigger>
</Act>
</Story>
<StopTrigger>
<ConditionGroup>
<Condition name="criteria_RunningStopTest" delay="0" conditionEdge="rising">
<ByValueCondition>
<ParameterCondition parameterRef="" value="" rule="lessThan"/>
</ByValueCondition>
</Condition>
<Condition name="criteria_RunningRedLightTest" delay="0" conditionEdge="rising">
<ByValueCondition>
<ParameterCondition parameterRef="" value="" rule="lessThan"/>
</ByValueCondition>
</Condition>
<Condition name="criteria_WrongLaneTest" delay="0" conditionEdge="rising">
<ByValueCondition>
<ParameterCondition parameterRef="" value="" rule="lessThan"/>
</ByValueCondition>
</Condition>
<Condition name="criteria_OnSidewalkTest" delay="0" conditionEdge="rising">
<ByValueCondition>
<ParameterCondition parameterRef="" value="" rule="lessThan"/>
</ByValueCondition>
</Condition>
<Condition name="criteria_KeepLaneTest" delay="0" conditionEdge="rising">
<ByValueCondition>
<ParameterCondition parameterRef="" value="" rule="lessThan"/>
</ByValueCondition>
</Condition>
<Condition name="criteria_CollisionTest" delay="0" conditionEdge="rising">
<ByValueCondition>
<ParameterCondition parameterRef="" value="" rule="lessThan"/>
</ByValueCondition>
</Condition>
<Condition name="criteria_DrivenDistanceTest" delay="0" conditionEdge="rising">
<ByValueCondition>
<ParameterCondition parameterRef="distance_success" value="100" rule="lessThan"/>
</ByValueCondition>
</Condition>
</ConditionGroup>
</StopTrigger>
</Storyboard>
</OpenSCENARIO>
Loading