Skip to content

Instantly share code, notes, and snippets.

@jS5t3r
Created November 4, 2019 17:02
Show Gist options
  • Select an option

  • Save jS5t3r/c1e2543ede9275b0c735b5100d3ef7c0 to your computer and use it in GitHub Desktop.

Select an option

Save jS5t3r/c1e2543ede9275b0c735b5100d3ef7c0 to your computer and use it in GitHub Desktop.
Adversary car should be able to drive backwards.
<?xml version="1.0" encoding="UTF-8"?>
<OpenSCENARIO>
<FileHeader revMajor="0" revMinor="9" date="2019-06-25" description="PedestrianCrossing" author="" />
<Catalogs>
<VehicleCatalog>
<Directory path="Catalogs/VehicleCatalogs" />
</VehicleCatalog>
<DriverCatalog>
<Directory path="Catalogs/DriverCatalogs" />
</DriverCatalog>
<PedestrianCatalog>
<Directory path="Catalogs/ObserverCatalogs" />
</PedestrianCatalog>
<PedestrianControllerCatalog>
<Directory path="Catalogs/PedestrianCatalogs" />
</PedestrianControllerCatalog>
<MiscObjectCatalog>
<Directory path="Catalogs/MiscObjectCatalogs" />
</MiscObjectCatalog>
<EnvironmentCatalog>
<Directory path="Catalogs/EnvironmentCatalogs" />
</EnvironmentCatalog>
<ManeuverCatalog>
<Directory path="Catalogs/ManeuverCatalogs" />
</ManeuverCatalog>
<TrajectoryCatalog>
<Directory path="Catalogs/TrajectoryCatalog" />
</TrajectoryCatalog>
<RouteCatalog>
<Directory path="Catalogs/RoutingCatalog" />
</RouteCatalog>
</Catalogs>
<RoadNetwork>
<Logics filepath="Town01" />
<SceneGraph filepath="" />
</RoadNetwork>
<Entities>
<Object name="hero">
<Vehicle name="vehicle.volkswagen.t2" category="car">
<ParameterDeclaration />
<Performance maxSpeed="69.444" maxDeceleration="10.0" mass="1800.0" />
<BoundingBox>
<Center x="1.5" y="0.0" z="0.9" />
<Dimension width="2.1" length="4.5" height="1.8" />
</BoundingBox>
<Axles>
<Front maxSteering="0.5" wheelDiameter="0.6" trackWidth="1.8" positionX="3.1" positionZ="0.3" />
<Rear maxSteering="0.0" wheelDiameter="0.6" trackWidth="1.8" positionX="0.0" positionZ="0.3" />
</Axles>
<Properties>
<Property name="rolename" value="hero" />
<Property name="type" value="ego_vehicle" />
</Properties>
</Vehicle>
</Object>
<Object name="adversary">
<Vehicle name="vehicle.lincoln.mkz2017" category="car">
<ParameterDeclaration />
<Performance maxSpeed="69.444" maxDeceleration="10.0" mass="1800.0" />
<BoundingBox>
<Center x="1.5" y="0.0" z="0.9" />
<Dimension width="2.1" length="4.5" height="1.8" />
</BoundingBox>
<Axles>
<Front maxSteering="0.5" wheelDiameter="0.6" trackWidth="1.8" positionX="3.1" positionZ="0.3" />
<Rear maxSteering="0.0" wheelDiameter="0.6" trackWidth="1.8" positionX="0.0" positionZ="0.3" />
</Axles>
<Properties>
<Property name="rolename" value="adversary" />
<Property name="type" value="simulation" />
</Properties>
</Vehicle>
</Object>
</Entities>
<Storyboard>
<Init>
<Actions>
<Global>
<SetEnvironment>
<Environment name="Environment1">
<TimeOfDay animation="false">
<Time hour="12" min="0" sec="0.0" />
<Date day="25" month="6" year="2019" />
</TimeOfDay>
<Weather cloudState="free">
<Sun intensity="1.0" azimuth="0.0" elevation="1.571" />
<Fog visualRange="100000.0" />
<Precipitation type="dry" intensity="0.0" />
</Weather>
<RoadCondition frictionScale="1.0" />
</Environment>
</SetEnvironment>
</Global>
<Private object="hero">
<Action>
<Position>
<World x="150" y="55" z="0" h="180" />
</Position>
</Action>
</Private>
<Private object="adversary">
<Action>
<Position>
<World x="110" y="54.5" z="0.3" h="180" />
</Position>
</Action>
</Private>
</Actions>
</Init>
<Story name="MyStory">
<Act name="Behavior">
<Sequence name="ManeuverSequence" numberOfExecutions="1">
<Actors>
<Entity name="adversary"/>
</Actors>
<Maneuver name="PedestrianCrossingManeuver">
<Event name="PedestrianStartsWalking" priority="overwrite">
<Action name="PedestrianStartsWalking">
<Private>
<Longitudinal>
<Speed>
<Dynamics shape="step" rate="0" distance="4.5" />
<Target>
<Absolute value="-10.0" />
</Target>
</Speed>
</Longitudinal>
</Private>
</Action>
<StartConditions>
<ConditionGroup>
<Condition name="StartCondition" delay="0" edge="rising">
<ByEntity>
<TriggeringEntities rule="any">
<Entity name="hero" />
</TriggeringEntities>
<EntityCondition>
<ReachPosition tolerance="2.0">
<Position>
<World x="140" y="55" z="0" h="180" />
</Position>
</ReachPosition>
</EntityCondition>
</ByEntity>
</Condition>
</ConditionGroup>
</StartConditions>
</Event>
<Event name="PedestrianStopsAndWaits" priority="overwrite">
<Action name="PedestrianStopsAndWaits">
<Private>
<Longitudinal>
<Speed>
<Dynamics shape="step" rate="0" time="10" />
<Target>
<Absolute value="0.0" />
</Target>
</Speed>
</Longitudinal>
</Private>
</Action>
<StartConditions>
<ConditionGroup>
<Condition name="StartCondition" delay="0" edge="rising">
<ByEntity>
<TriggeringEntities rule="any">
<Entity name="adversary" />
</TriggeringEntities>
<EntityCondition>
<StandStill duration="1" />
</EntityCondition>
</ByEntity>
</Condition>
</ConditionGroup>
</StartConditions>
</Event>
</Maneuver>
</Sequence>
<Conditions>
<Start>
<ConditionGroup>
<Condition name="OverallStartCondition" delay="0" edge="rising">
<ByEntity>
<TriggeringEntities rule="any">
<Entity name="hero" />
</TriggeringEntities>
<EntityCondition>
<TraveledDistance value="10.0" />
</EntityCondition>
</ByEntity>
</Condition>
</ConditionGroup>
</Start>
<End>
<ConditionGroup>
<Condition name="EndCondition" delay="0" edge="rising">
<ByEntity>
<TriggeringEntities rule="any">
<Entity name="hero" />
</TriggeringEntities>
<EntityCondition>
<TraveledDistance value="200.0" />
</EntityCondition>
</ByEntity>
</Condition>
</ConditionGroup>
</End>
</Conditions>
</Act>
</Story>
<EndConditions>
<ConditionGroup>
<Condition name="RunningStopTest" delay="0" edge="rising">
<ByValue>
<Parameter name="" value="" rule="less_than" />
</ByValue>
</Condition>
<Condition name="RunningRedLightTest" delay="0" edge="rising">
<ByValue>
<Parameter name="" value="" rule="less_than" />
</ByValue>
</Condition>
<Condition name="WrongLaneTest" delay="0" edge="rising">
<ByValue>
<Parameter name="" value="" rule="less_than" />
</ByValue>
</Condition>
<Condition name="OnSidewalkTest" delay="0" edge="rising">
<ByValue>
<Parameter name="" value="" rule="less_than" />
</ByValue>
</Condition>
<Condition name="KeepLaneTest" delay="0" edge="rising">
<ByValue>
<Parameter name="" value="" rule="less_than" />
</ByValue>
</Condition>
<Condition name="CollisionTest" delay="0" edge="rising">
<ByValue>
<Parameter name="" value="" rule="less_than" />
</ByValue>
</Condition>
<Condition name="DrivenDistanceTest" delay="0" edge="rising">
<ByValue>
<Parameter name="distance_success" value="100" rule="less_than" />
</ByValue>
</Condition>
</ConditionGroup>
</EndConditions>
</Storyboard>
</OpenSCENARIO>
@ronyshaji
Copy link
Copy Markdown

@jS5t3r Hey, Did the negative velocity script work?

@jS5t3r
Copy link
Copy Markdown
Author

jS5t3r commented Aug 4, 2023

No, it did not work at that time. You must change the gear first and the velocity must stay positive. I haven't continued working on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment