Skip to content
Snippets Groups Projects
  • René Paris's avatar
    7f8a55dc
    :beetle: Allow Acts and Events to trigger at different times · 7f8a55dc
    René Paris authored
    The StartTrigger implementation did not store its success state and fell
    back to `running` in every consecutive step. This prevented children to
    execute and consequently, StartTrigger of children (e.g. act -> events)
    could never succeed at the same time. If a trigger now succeeds, its
    state is stored and children can check their trigger independently (not
    only at the very same timestep).
    7f8a55dc
    History
    :beetle: Allow Acts and Events to trigger at different times
    René Paris authored
    The StartTrigger implementation did not store its success state and fell
    back to `running` in every consecutive step. This prevented children to
    execute and consequently, StartTrigger of children (e.g. act -> events)
    could never succeed at the same time. If a trigger now succeeds, its
    state is stored and children can check their trigger independently (not
    only at the very same timestep).
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
scenario.xosc 6.12 KiB
<?xml version="1.0"?>
<OpenSCENARIO>
  <FileHeader revMajor="1" revMinor="1" date="2021-08-25T00:00:00" description="OSE Example Scenario" author="rene.paris@in-tech.com"/>
  <ParameterDeclarations>
  </ParameterDeclarations>
  <CatalogLocations>
    <VehicleCatalog>
      <Directory path="vehicles"/>
    </VehicleCatalog>
    <PedestrianCatalog>
      <Directory path=""/>
    </PedestrianCatalog>
    <ControllerCatalog>
      <Directory path=""/>
    </ControllerCatalog>
    <ManeuverCatalog>
      <Directory path=""/>
    </ManeuverCatalog>
    <MiscObjectCatalog>
      <Directory path=""/>
    </MiscObjectCatalog>
    <EnvironmentCatalog>
      <Directory path=""/>
    </EnvironmentCatalog>
    <TrajectoryCatalog>
      <Directory path=""/>
    </TrajectoryCatalog>
    <RouteCatalog>
      <Directory path=""/>
    </RouteCatalog>
  </CatalogLocations>
  <RoadNetwork>
    <LogicFile filepath="scenery.xodr"/>
    <SceneGraphFile filepath=""/>
    <TrafficSignals>
      <TrafficSignalController name="TrafficSignal1">
        <Phase duration="1" name="Phase1">
          <TrafficSignalState state="green" trafficSignalId="1"/>
        </Phase>
        <Phase duration="1" name="Phase2">
          <TrafficSignalState state="yellow" trafficSignalId="1"/>
        </Phase>
        <Phase duration="1" name="Phase3">
          <TrafficSignalState state="red" trafficSignalId="1"/>
        </Phase>
        <Phase duration="1" name="Phase4">
          <TrafficSignalState state="red yellow" trafficSignalId="1"/>
        </Phase>
      </TrafficSignalController>
    </TrafficSignals>
  </RoadNetwork>
  <Entities>
    <ScenarioObject name="Vehicle1">
      <CatalogReference catalogName="VehicleCatalog" entryName="car_bmw_i3"/>
    </ScenarioObject>
    <ScenarioObject name="Vehicle2">
      <CatalogReference catalogName="VehicleCatalog" entryName="car_bmw_3"/>
    </ScenarioObject>
  </Entities>
  <Storyboard>
    <Init>
      <Actions>
        <Private entityRef="Vehicle1">
          <PrivateAction>
            <TeleportAction>
              <Position>
                <LanePosition roadId="1" laneId="-1" offset="0.0" s="10.0"/>
              </Position>
            </TeleportAction>
          </PrivateAction>
          <PrivateAction>
            <LongitudinalAction>
              <SpeedAction>
                <SpeedActionDynamics dynamicsShape="linear" value="0.0" dynamicsDimension="rate"/>
                <SpeedActionTarget>
                  <AbsoluteTargetSpeed value="43.5"/>
                </SpeedActionTarget>
              </SpeedAction>
            </LongitudinalAction>
          </PrivateAction>
        </Private>
        <Private entityRef="Vehicle2">
          <PrivateAction>
            <TeleportAction>
              <Position>
                <LanePosition roadId="1" laneId="-2" offset="0.0" s="100.0"/>
              </Position>
            </TeleportAction>
          </PrivateAction>
          <PrivateAction>
            <LongitudinalAction>
              <SpeedAction>
                <SpeedActionDynamics dynamicsShape="linear" value="0.0" dynamicsDimension="rate"/>
                <SpeedActionTarget>
                  <AbsoluteTargetSpeed value="25.0"/>
                </SpeedActionTarget>
              </SpeedAction>
            </LongitudinalAction>
          </PrivateAction>
        </Private>
      </Actions>
    </Init>
    <Story name="ExampleStory">
      <Act name="Act1">
        <ManeuverGroup maximumExecutionCount="1" name="ExampleManeuverGroup">
          <Actors selectTriggeringEntities="true" />
          <Maneuver name="LaneChangeManeuver">
            <Event name="MyLaneChangeRightEvent" priority="overwrite">
              <Action name="LaneChange">
                <PrivateAction>
                  <LateralAction>
                    <LaneChangeAction>
                      <LaneChangeActionDynamics dynamicsShape="sinusoidal" value="2.0" dynamicsDimension="time"/>
                      <LaneChangeTarget>
                        <RelativeTargetLane entityRef="Vehicle1" value="0"/>
                      </LaneChangeTarget>
                    </LaneChangeAction>
                  </LateralAction>
                </PrivateAction>
              </Action>
              <StartTrigger>
                <ConditionGroup>
                  <Condition name="NotAtStart" delay="0" conditionEdge="none">
                    <ByValueCondition>
                      <SimulationTimeCondition value="0" rule="greaterThan" />
                    </ByValueCondition>
                  </Condition>
                  <Condition name="Conditional" delay="1" conditionEdge="rising">
                    <ByEntityCondition>
                      <TriggeringEntities triggeringEntitiesRule="all">
                        <EntityRef entityRef="Vehicle2"/>
                        <EntityRef entityRef="Vehicle3"/>
                        <EntityRef entityRef="Vehicle4"/>
                      </TriggeringEntities>
                      <EntityCondition>
                        <ReachPositionCondition tolerance="15.0">
                          <Position>
                            <RelativeLanePosition entityRef="Vehicle1" dLane="-1" dsLane="20" />
                          </Position>
                        </ReachPositionCondition>
                      </EntityCondition>
                    </ByEntityCondition>
                  </Condition>
                </ConditionGroup>
              </StartTrigger>
            </Event>
          </Maneuver>
        </ManeuverGroup>
        <StartTrigger>
          <ConditionGroup>
            <Condition name="FromStart" delay="0" conditionEdge="rising">
              <ByValueCondition>
                <SimulationTimeCondition value="0.0" rule="greaterOrEqual" />
              </ByValueCondition>
            </Condition>
          </ConditionGroup>
        </StartTrigger>
      </Act>
    </Story>
    <StopTrigger>
      <ConditionGroup>
        <Condition name="EndTime" delay="0" conditionEdge="rising">
          <ByValueCondition>
            <SimulationTimeCondition value="5.0" rule="greaterThan"/>
          </ByValueCondition>
        </Condition>
      </ConditionGroup>
    </StopTrigger>
  </Storyboard>
</OpenSCENARIO>