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

The stop trigger on the storyboard is not working. #1069

Open
hlsongg opened this issue Apr 5, 2024 · 2 comments
Open

The stop trigger on the storyboard is not working. #1069

hlsongg opened this issue Apr 5, 2024 · 2 comments

Comments

@hlsongg
Copy link

hlsongg commented Apr 5, 2024

I made an example of the situation below.

[Example]

  1. The Ego vehicle starts at SimulationTime = 0 and increases the speed from 0 to 60 km/h. (Accelerate for 5 seconds)
  2. In front of the lane where the Ego vehicle(hero) is located, there is a counter vehicle(standing).
  3. If the distance between the Ego vehicle(hero) and the counter vehicle(standing) is narrowed to 30 m, the speed of the Ego vehicle(hero) is reduced to 30 km/h.
  4. Both vehicles continue to drive for 1 minute and terminate.

I have a OpenSCENARIO file which has scenario end condition (StopTrigger on StoryBoard) as StoryboardElementStateCondition converting to endTransition. However, after SlowPrecordingStartCondition is triggered, the stop trigger does not work and ends with the following error. How can I fix it to do the scenario as intended?
Destroying ego vehicle 147
ERROR: failed to destroy actor 147 : unable to destroy actor: not found

`

<Init>
  <Actions>	  

    <GlobalAction> 
      <EnvironmentAction>
        <Environment name="Environment1">
          <TimeOfDay animation="false" dateTime="2024-03-25T12: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="4.0"/>
        </Environment>
      </EnvironmentAction>
    </GlobalAction>

    <!-- 1. The Ego vehicle starts at SimulationTime = 0 and increases the speed from 0 to 60 km/h. (Accelerate for 5 seconds) -->
    <Private entityRef="hero">
      <PrivateAction> 
        <TeleportAction>
          <Position>
            <WorldPosition x="-9.4" y="-152.8" z="0.5" h="1.57079632679"/>
          </Position>
        </TeleportAction>
      </PrivateAction>

      <PrivateAction>
        <LongitudinalAction>
          <SpeedAction> 
            <SpeedActionDynamics dynamicsShape="linear" dynamicsDimension="rate" value="4.0"/> 
              <SpeedActionTarget> 
                <AbsoluteTargetSpeed value="16.6667"/> <!-- ${60 / 3.6} -->
              </SpeedActionTarget>
          </SpeedAction>
        </LongitudinalAction>
      </PrivateAction>

    </Private>

		<!-- 2. In front of the lane where the Ego vehicle is located, there is a counter vehicle. -->
    <Private entityRef="standing">
      <PrivateAction>
        <TeleportAction> 
          <Position>
            <WorldPosition x="-9.4" y="-2.8" z="0.5" h="1.57079632679"/>
          </Position>
        </TeleportAction>
      </PrivateAction>

      <PrivateAction>
        <LongitudinalAction>
          <SpeedAction>
            <SpeedActionDynamics dynamicsShape="step" dynamicsDimension="time" value="0.0"/>
            <SpeedActionTarget>
              <AbsoluteTargetSpeed value="8.33333"/> <!-- ${30 / 3.6} -->
            </SpeedActionTarget>
          </SpeedAction>
        </LongitudinalAction>
      </PrivateAction>
    </Private>
  </Actions>
</Init>


<Story name="SlowPrecedingStory"> 
  <Act name="SlowPrecedingAct">
    	      <ManeuverGroup maximumExecutionCount="1" name="SlowPrecedingSequence">
      <Actors selectTriggeringEntities="false">
        <EntityRef entityRef="hero"/>
      </Actors>
      <Maneuver name="SlowPrecedingManeuver">
        <Event name="SlowPrecedingEvent" priority="overwrite">
          <Action name="SlowPrecedingAction"> 
            <PrivateAction>
            
              <LongitudinalAction>
                <SpeedAction>
                  <SpeedActionDynamics  dynamicsShape="linear" 
                                        dynamicsDimension="rate"
                                        value="16.0"/> <!-- delta/sec -->
                  <SpeedActionTarget>
                    <AbsoluteTargetSpeed value="8.33333"/> <!-- ${30 / 3.6} -->
                  </SpeedActionTarget>
                </SpeedAction>
              </LongitudinalAction>
            </PrivateAction>
          </Action>
          
          
          <StartTrigger> 
            <ConditionGroup>
            <!-- 3. If the distance between the Ego vehicle and the red_Vehicle is narrowed to 30 m, the speed of the Ego vehicle is reduced to 30 km/h. -->
              <Condition name="SlowPrecedingStartCondition" delay="0" conditionEdge="rising">
				          <ByEntityCondition>
                  <TriggeringEntities triggeringEntitiesRule="any">
                    <EntityRef entityRef="hero"/>
                  </TriggeringEntities>
                  <EntityCondition> 
								    
								      <RelativeDistanceCondition 	entityRef="standing"
											                    				relativeDistanceType="longitudinal"
														                    	value="30"
												                    			freespace="true"
													                    		rule="lessThan"/>
							      </EntityCondition>
                </ByEntityCondition>
              </Condition>
            </ConditionGroup>
          </StartTrigger>
        </Event>
      </Maneuver>
    </ManeuverGroup>
		
		
    <StartTrigger> 
      <ConditionGroup>
        <Condition name="SlowPrecedingActStart" delay="0" conditionEdge="none">
          <ByValueCondition>
            <SimulationTimeCondition value="0" rule="greaterThan"/> 
          </ByValueCondition>
        </Condition>
      </ConditionGroup>
    </StartTrigger>
  </Act>
</Story>

<StopTrigger> 
  <ConditionGroup>
    
    <Condition name="ActStopCondition" delay="60" conditionEdge="rising">
    <!-- 4. Continue to drive both vehicles for 1 minute before terminating. --> 
      <ByValueCondition> 
        <StoryboardElementStateCondition storyboardElementType="maneuver" storyboardElementRef="SlowPrecedingManeuver" state="endTransition"/>
      </ByValueCondition>
    </Condition>
  </ConditionGroup>
</StopTrigger>
`
@dx6nxr
Copy link
Contributor

dx6nxr commented Oct 11, 2024

If I remember correctly, endTransition is not supported as for now.

Best, Ivan

@dx6nxr
Copy link
Contributor

dx6nxr commented Oct 16, 2024

If I remember correctly, endTransition is not supported as for now.

Best, Ivan

Following on my previous reply: endTransition is indeed supported, but i not treated as "transition" so to say. In openscenario_parser.py,
image
all of them are treated equally, as the finished state of the manueverGroup in this case.

Considering the trigger problem:

In your case it is following:
Vehicles move, when the distance changes to <30 meters, the manueverGroup is being executed (the one inside of SlowPrecedingStory). As it is the only manueverGroup present in the file, the simulation just ends when the manueverGroup is fully executed, as there are no other manueverGroups to execute and therefore stopTrigger is being "ignored" as there's nothing more to run and therefore to stop.

Solution: add another manueverGroup that keeps vehicle driving for another minute.

Hope this helps.
Best,
Ivan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants