guardstrikelab / scenario_runner

Traffic scenario definition and execution engine supporting OpenScenario 2.0
https://carla-scenariorunner.readthedocs.io/en/latest/
MIT License
13 stars 5 forks source link

Problem with OpenScenario Waypoint based Scenario #6

Open ronyshaji opened 1 year ago

ronyshaji commented 1 year ago

Hello I am facing an issue with waypoint based OpenScenario on scenario runner. The first event is happening and the next event is based on start trigger which is based on StoryboardElementStateCondition . Only the first event is running and then the second event is not starting. Do you giúys know the reason? is the Openscenario file wrong? @SEEKERXC @synkrotron


<?xml version="1.0" ?>
<OpenSCENARIO>
    <FileHeader revMajor="1" revMinor="0" date="2023-08-23T15:40:06" description="Generated OpenSCENARIO File" author="QGIS OSCGenerator Plugin"/>
    <ParameterDeclarations/>
    <CatalogLocations/>
    <RoadNetwork>
        <LogicFile filepath="Town01"/>
        <SceneGraphFile filepath=""/>
    </RoadNetwork>
    <Entities>
        <ScenarioObject name="ego_vehicle">
            <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"/>
                </Properties>
            </Vehicle>
        </ScenarioObject>
    </Entities>
    <Storyboard>
        <Init>
            <Actions>
                <GlobalAction>
                    <EnvironmentAction>
                        <Environment name="Environment1">
                            <TimeOfDay animation="false" dateTime="2020-10-23T06:00:00"/>
                            <Weather cloudState="free">
                                <Sun intensity="0.85" azimuth="0" elevation="1.31"/>
                                <Fog visualRange="100000"/>
                                <Precipitation precipitationType="dry" intensity="0"/>
                            </Weather>
                            <RoadCondition frictionScaleFactor="1.0"/>
                        </Environment>
                    </EnvironmentAction>
                </GlobalAction>
                <Private entityRef="ego_vehicle">
                    <PrivateAction>
                        <TeleportAction>
                            <Position>
                                <WorldPosition x="227.45982003991156" y="-133.35433041938637" z="0.19902960555998356" h="-0.00044804639014223"/>
                            </Position>
                        </TeleportAction>
                    </PrivateAction>
                    <PrivateAction>
                        <ControllerAction>
                            <AssignControllerAction>
                                <Controller name="HeroAgent_1">
                                    <Properties>
                                        <Property name="module" value="simple_vehicle_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>
                    <PrivateAction>
                        <LongitudinalAction>
                            <SpeedAction>
                                <SpeedActionDynamics dynamicsShape="step" value="0.1" dynamicsDimension="distance"/>
                                <SpeedActionTarget>
                                    <AbsoluteTargetSpeed value="7"/>
                                </SpeedActionTarget>
                            </SpeedAction>
                        </LongitudinalAction>
                    </PrivateAction>
                </Private>
            </Actions>
        </Init>
        <Story name="OSC Generated Story">
            <Act name="OSC Generated Act">
                <ManeuverGroup maximumExecutionCount="1" name="Maneuver group for ego_vehicle">
                    <Actors selectTriggeringEntities="false">
                        <EntityRef entityRef="ego_vehicle"/>
                    </Actors>
                    <Maneuver name="Maneuver ID 1">
                        <Event name="MovingForward" priority="overwrite">
                            <Action name="MovingForward">
                                <PrivateAction>
                                    <RoutingAction>
                                        <AssignRouteAction>
                                            <Route name="OSC Generated Route" closed="false">
                                                <Waypoint routeStrategy="fastest">
                                                    <Position>
                                                        <WorldPosition x="230.84823061972193" y="-133.25677310970136" z="0" h="-0.00044804639042539727"/>
                                                    </Position>
                                                </Waypoint>
                                                <Waypoint routeStrategy="fastest">
                                                    <Position>
                                                        <WorldPosition x="234.6786077967439" y="-133.4518877371409" z="0" h="-0.0004480463904255246"/>
                                                    </Position>
                                                </Waypoint>
                                                <Waypoint routeStrategy="fastest">
                                                    <Position>
                                                        <WorldPosition x="240.08042176469377" y="-133.45188774137574" z="0" h="-0.00044804639014223"/>
                                                    </Position>
                                                </Waypoint>
                                                <Waypoint routeStrategy="fastest">
                                                    <Position>
                                                        <WorldPosition x="248.33046491543848" y="-134.23234624609083" z="0" h="-0.00044804499852956733"/>
                                                    </Position>
                                                </Waypoint>
                                                <Waypoint routeStrategy="fastest">
                                                    <Position>
                                                        <WorldPosition x="257.16979686396104" y="-134.03723162898632" z="0" h="-0.00044804569438110155"/>
                                                    </Position>
                                                </Waypoint>
                                                <Waypoint routeStrategy="fastest">
                                                    <Position>
                                                        <WorldPosition x="264.92876601912894" y="-133.93967432343698" z="0" h="-0.00044804639014223"/>
                                                    </Position>
                                                </Waypoint>
                                                <Waypoint routeStrategy="fastest">
                                                    <Position>
                                                        <WorldPosition x="272.3930907762917" y="-133.93967433008413" z="0" h="-0.00044804569438110155"/>
                                                    </Position>
                                                </Waypoint>
                                                <Waypoint routeStrategy="fastest">
                                                    <Position>
                                                        <WorldPosition x="279.9556303331834" y="-134.0372316492849" z="0" h="-0.00044804639014172065"/>
                                                    </Position>
                                                </Waypoint>
                                                <Waypoint routeStrategy="fastest">
                                                    <Position>
                                                        <WorldPosition x="289.0896066817532" y="-134.03723165790538" z="0" h="-0.00044804639042565194"/>
                                                    </Position>
                                                </Waypoint>
                                            </Route>
                                        </AssignRouteAction>
                                    </RoutingAction>
                                </PrivateAction>
                            </Action>
                            <StartTrigger>
                                <ConditionGroup>
                                    <Condition name="MovingForward" delay="0" conditionEdge="rising">
                                        <ByValueCondition>
                                            <SimulationTimeCondition value="0.0" rule="greaterThan"/>
                                        </ByValueCondition>
                                    </Condition>
                                </ConditionGroup>
                            </StartTrigger>
                        </Event>
                        <Event name="StandingStill" priority="overwrite">
                            <Action name="StandingStill">
                                <PrivateAction>
                                    <LongitudinalAction>
                                        <SpeedAction>
                                            <SpeedActionDynamics dynamicsShape="step" value="0.1" dynamicsDimension="time"/>
                                            <SpeedActionTarget>
                                                <AbsoluteTargetSpeed value="2"/>
                                            </SpeedActionTarget>
                                        </SpeedAction>
                                    </LongitudinalAction>
                                </PrivateAction>
                            </Action>
                            <StartTrigger>
                                <ConditionGroup>
                                    <Condition name="Condition for Maneuver ID 2" delay="0" conditionEdge="rising">
                                        <ByValueCondition>
                                            <StoryboardElementStateCondition storyboardElementType="action" storyboardElementRef="MovingForward" state="completeState"/>
                                        </ByValueCondition>
                                    </Condition>
                                </ConditionGroup>
                            </StartTrigger>
                        </Event>
                        <Event name="ReverseAssit" priority="overwrite">
                            <Action name="ReverseAssit">
                                <PrivateAction>
                                    <LongitudinalAction>
                                        <SpeedAction>
                                            <SpeedActionDynamics dynamicsShape="step" value="1000" dynamicsDimension="time"/>
                                            <SpeedActionTarget>
                                                <AbsoluteTargetSpeed value="-5"/>
                                            </SpeedActionTarget>
                                        </SpeedAction>
                                    </LongitudinalAction>
                                </PrivateAction>
                            </Action>
                            <StartTrigger>
                                <ConditionGroup>
                                    <Condition name="AfterLeadingVehicleKeepsVelocity" delay="0" conditionEdge="rising">
                                        <ByValueCondition>
                                            <StoryboardElementStateCondition storyboardElementType="action" storyboardElementRef="StandingStill" state="endTransition"/>
                                        </ByValueCondition>
                                    </Condition>
                                </ConditionGroup>
                            </StartTrigger>
                        </Event>
                    </Maneuver>
                </ManeuverGroup>
                <StartTrigger>
                    <ConditionGroup>
                        <Condition name="StartTime" delay="0" conditionEdge="rising">
                            <ByValueCondition>
                                <SimulationTimeCondition rule="equalTo" value="0"/>
                            </ByValueCondition>
                        </Condition>
                    </ConditionGroup>
                </StartTrigger>
                <StopTrigger>
                    <ConditionGroup>
                        <Condition name="EndCondition" delay="0" conditionEdge="rising">
                            <ByValueCondition>
                                <SimulationTimeCondition rule="equalTo" value="100"/>
                            </ByValueCondition>
                        </Condition>
                    </ConditionGroup>
                </StopTrigger>
            </Act>
        </Story>
        <StopTrigger>
            <ConditionGroup>
                <Condition name="criteria_CollisionTest" delay="0.0" conditionEdge="rising">
                    <ByValueCondition>
                        <ParameterCondition parameterRef="" value="0.0" rule="lessThan"/>
                    </ByValueCondition>
                </Condition>
            </ConditionGroup>
            <ConditionGroup>
                <Condition name="criteria_DrivenDistanceTest" delay="0.0" conditionEdge="rising">
                    <ByValueCondition>
                        <ParameterCondition parameterRef="distance_success" value="47" rule="greaterThan"/>
                    </ByValueCondition>
                </Condition>
            </ConditionGroup>
            <ConditionGroup>
                <Condition name="criteria_KeepLaneTest" delay="0.0" conditionEdge="rising">
                    <ByValueCondition>
                        <ParameterCondition parameterRef="" value="0.0" rule="lessThan"/>
                    </ByValueCondition>
                </Condition>
            </ConditionGroup>
            <ConditionGroup>
                <Condition name="criteria_OnSidewalkTest" delay="0.0" conditionEdge="rising">
                    <ByValueCondition>
                        <ParameterCondition parameterRef="" value="0.0" rule="lessThan"/>
                    </ByValueCondition>
                </Condition>
            </ConditionGroup>
            <ConditionGroup>
                <Condition name="criteria_RunningRedLightTest" delay="0.0" conditionEdge="rising">
                    <ByValueCondition>
                        <ParameterCondition parameterRef="" value="0.0" rule="lessThan"/>
                    </ByValueCondition>
                </Condition>
            </ConditionGroup>
            <ConditionGroup>
                <Condition name="criteria_RunningStopTest" delay="0.0" conditionEdge="rising">
                    <ByValueCondition>
                        <ParameterCondition parameterRef="" value="0.0" rule="lessThan"/>
                    </ByValueCondition>
                </Condition>
            </ConditionGroup>
            <ConditionGroup>
                <Condition name="criteria_WrongLaneTest" delay="0.0" conditionEdge="rising">
                    <ByValueCondition>
                        <ParameterCondition parameterRef="" value="0.0" rule="lessThan"/>
                    </ByValueCondition>
                </Condition>
            </ConditionGroup>
        </StopTrigger>
    </Storyboard>
</OpenSCENARIO>
synkrotron commented 1 year ago

Thanks for your attention, we will try to reproduce this.

ronyshaji commented 1 year ago

@synkrotron You can start the scenario runner and run it. And please give the feedback too whther it is working for you.

ronyshaji commented 1 year ago

@synkrotron Hey, Do you have any update on this? Any feedback would be great !!

synkrotron commented 1 year ago

I have reproduced this issue, but I could not find the root cause. It appears that the second event, StartTrigger, is not functioning properly. We need to investigate further.

ronyshaji commented 1 year ago

@synkrotron When i checked the openscenario parser, i saw a TODO comment and i think it points to the issue.

The route based event is not finishing or stopping even after the vehicle completed the waypoints in the openscenario file.