ALKS样例
根据官方提供的ALKS样例,提供了一些osc2.0的场景(osc文件)及其适用于仿真器A的转化结果(xosc文件)。考虑到仿真器A的支持程度,建议在转换时选择osc1.0版本。
FreeDriving
简述:主车Ego按照初始速度匀速行驶,10000s后激活controller,300s后停止场景(激活时间与场景停止时间可修改)。
osc2.0场景
import standard scenario FreeDriving: # map map: map map.set_map_file("./ALKS_Road_Different_Curvatures.xodr") # parameter m_odr: odr_point = map.create_odr_point(road_id: '0', lane_id: '-4', s: 5.0m, t: 0.0m) Ego_InitPosition: pose_3d with: keep(it.odr_point == m_odr) Ego_InitSpeed_Ve0: speed = 16.66666667mps Duration: time = 300s # entity Ego_Name: string = "Audi_A3_2009_black" Ego_Controller: string = "DefaultDriver" Ego: vehicle with: keep(it.name == Ego_Name) keep(it.initial_bm == Ego_Controller) # storyboard do parallel(duration: Duration): # init Ego.assign_init_position(position: Ego_InitPosition) Ego.assign_init_speed(Ego_InitSpeed_Ve0) # act1: ActivateALKSControllerAct serial: wait elapsed(10000s) Ego.activate_controller(true, true) # args: lateral, longitudinal
转化结果
<OpenSCENARIO > <FileHeader author="Octopus/Simulation" date="2022-10-28T07:45:48" description="" revMajor="1" revMinor="0"/ > <CatalogLocations > <VehicleCatalog > <Directory path="Distros/Current/Config/Players/Vehicles"/ > </VehicleCatalog > <ControllerCatalog > <Directory path="Distros/Current/Config/Players/driverCfg.xml"/ > </ControllerCatalog > <PedestrianCatalog > <Directory path="Distros/Current/Config/Players/Pedestrians"/ > </PedestrianCatalog > <MiscObjectCatalog > <Directory path="Distros/Current/Config/Players/Objects"/ > </MiscObjectCatalog > </CatalogLocations > <RoadNetwork > <LogicFile filepath="./ALKS_Road_Different_Curvatures.xodr"/ > <SceneGraphFile filepath=""/ > </RoadNetwork > <Entities > <ScenarioObject name="Ego" > <Vehicle name="Audi_A3_2009_black" vehicleCategory="car" > <BoundingBox > <Center x="1.5" y="0" z="0.9"/ > <Dimensions height="2.1" length="4.5" width="1.8"/ > </BoundingBox > <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/ > <Axles > <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > </Axles > <Properties > <Property name="control" value="external"/ > </Properties > </Vehicle > <ObjectController > <Controller name="DefaultDriver" > <Properties/ > </Controller > </ObjectController > </ScenarioObject > </Entities > <Storyboard > <Init > <Actions > <Private entityRef="Ego" > <PrivateAction > <TeleportAction > <Position > <LanePosition laneId="-4" offset="0" roadId="0" s="5"/ > </Position > </TeleportAction > </PrivateAction > <PrivateAction > <LongitudinalAction > <SpeedAction > <SpeedActionDynamics dynamicsDimension="time" dynamicsShape="step" value="0"/ > <SpeedActionTarget > <AbsoluteTargetSpeed value="16.66666667"/ > </SpeedActionTarget > </SpeedAction > </LongitudinalAction > </PrivateAction > </Private > </Actions > </Init > <Story name="FreeDrivingStory" > <Act name="Ego_activate_controller_7_act" > <ManeuverGroup maximumExecutionCount="1" name="Ego_activate_controller_7_maneuvers" > <Actors selectTriggeringEntities="false" > <EntityRef entityRef="Ego"/ > </Actors > <Maneuver name="Ego_activate_controller_7_maneuver" > <Event maximumExecutionCount="1" name="Ego_activate_controller_7_event" priority="overwrite" > <Action name="Ego_activate_controller_7" > <PrivateAction > <ActivateControllerAction lateral="true" longitudinal="true"/ > </PrivateAction > </Action > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_7_condition_1" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="0"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Event > </Maneuver > </ManeuverGroup > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_7_condition" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="10000"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Act > </Story > <StopTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="story_end" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="300"/ > </ByValueCondition > </Condition > </ConditionGroup > </StopTrigger > </Storyboard > </OpenSCENARIO>
FullyBlockingTarget
简述:主车Ego按照初始速度匀速行驶,正前方495m处有一位行人,10000s后激活Ego的controller,40s后停止场景(激活时间与场景停止时间可修改)。
osc2.0场景
import standard scenario FullyBlockingTarget: # map map: map map.set_map_file("./ALKS_Road.xodr") # parameter Ego_InitPosition_LaneId: string = '-4' Ego_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 5.0m, t: 0.0m) Ego_InitPosition: pose_3d with: keep(it.odr_point == Ego_Odr) TargetBlocking_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 500.0m, t: 0.0m) TargetBlocking_InitPosition: pose_3d with: keep(it.odr_point == TargetBlocking_Odr) Ego_InitSpeed_Ve0: speed = 16.66666667mps Duration: time = 40s # entity Ego_Name: string = "Audi_A3_2009_black" Ego_Controller: string = "DefaultDriver" Ego: vehicle with: keep(it.name == Ego_Name) keep(it.initial_bm == Ego_Controller) TargetBlocking: person with: keep(it.name == "Christian") keep(it.model == "male_adult") # storyboard do parallel(duration: Duration): # init Ego.assign_init_position(position: Ego_InitPosition) Ego.assign_init_speed(Ego_InitSpeed_Ve0) TargetBlocking.assign_init_position(position: TargetBlocking_InitPosition) # act1: ActivateALKSControllerAct serial: wait elapsed(10000s) Ego.activate_controller(true, true) # args: lateral, longitudinal
转化结果
<OpenSCENARIO > <FileHeader author="Octopus/Simulation" date="2022-10-28T07:58:37" description="" revMajor="1" revMinor="0"/ > <CatalogLocations > <VehicleCatalog > <Directory path="Distros/Current/Config/Players/Vehicles"/ > </VehicleCatalog > <ControllerCatalog > <Directory path="Distros/Current/Config/Players/driverCfg.xml"/ > </ControllerCatalog > <PedestrianCatalog > <Directory path="Distros/Current/Config/Players/Pedestrians"/ > </PedestrianCatalog > <MiscObjectCatalog > <Directory path="Distros/Current/Config/Players/Objects"/ > </MiscObjectCatalog > </CatalogLocations > <RoadNetwork > <LogicFile filepath="./ALKS_Road.xodr"/ > <SceneGraphFile filepath=""/ > </RoadNetwork > <Entities > <ScenarioObject name="Ego" > <Vehicle name="Audi_A3_2009_black" vehicleCategory="car" > <BoundingBox > <Center x="1.5" y="0" z="0.9"/ > <Dimensions height="2.1" length="4.5" width="1.8"/ > </BoundingBox > <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/ > <Axles > <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > </Axles > <Properties > <Property name="control" value="external"/ > </Properties > </Vehicle > <ObjectController > <Controller name="DefaultDriver" > <Properties/ > </Controller > </ObjectController > </ScenarioObject > <ScenarioObject name="TargetBlocking" > <Pedestrian mass="80" model="male_adult" name="Christian" pedestrianCategory="pedestrian" > <BoundingBox > <Center x="1.5" y="0" z="0.9"/ > <Dimensions height="2.1" length="4.5" width="1.8"/ > </BoundingBox > <Properties/ > </Pedestrian > </ScenarioObject > </Entities > <Storyboard > <Init > <Actions > <Private entityRef="Ego" > <PrivateAction > <TeleportAction > <Position > <LanePosition laneId="-4" offset="0" roadId="0" s="5"/ > </Position > </TeleportAction > </PrivateAction > <PrivateAction > <LongitudinalAction > <SpeedAction > <SpeedActionDynamics dynamicsDimension="time" dynamicsShape="step" value="0"/ > <SpeedActionTarget > <AbsoluteTargetSpeed value="16.66666667"/ > </SpeedActionTarget > </SpeedAction > </LongitudinalAction > </PrivateAction > </Private > <Private entityRef="TargetBlocking" > <PrivateAction > <TeleportAction > <Position > <LanePosition laneId="-4" offset="0" roadId="0" s="500"/ > </Position > </TeleportAction > </PrivateAction > </Private > </Actions > </Init > <Story name="FullyBlockingTargetStory" > <Act name="Ego_activate_controller_7_act" > <ManeuverGroup maximumExecutionCount="1" name="Ego_activate_controller_7_maneuvers" > <Actors selectTriggeringEntities="false" > <EntityRef entityRef="Ego"/ > </Actors > <Maneuver name="Ego_activate_controller_7_maneuver" > <Event maximumExecutionCount="1" name="Ego_activate_controller_7_event" priority="overwrite" > <Action name="Ego_activate_controller_7" > <PrivateAction > <ActivateControllerAction lateral="true" longitudinal="true"/ > </PrivateAction > </Action > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_7_condition_1" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="0"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Event > </Maneuver > </ManeuverGroup > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_7_condition" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="10000"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Act > </Story > <StopTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="story_end" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="40"/ > </ByValueCondition > </Condition > </ConditionGroup > </StopTrigger > </Storyboard > </OpenSCENARIO>
PartiallyBlockingTarget
简述:主车Ego按照初始速度匀速行驶,斜前方495米处有一位行人,10000s后激活Ego的controller,40s后停止场景(激活时间与场景停止时间可修改)。
osc2.0场景
import standard scenario PartiallyBlockingTarget: # map map: map map.set_map_file("./ALKS_Road.xodr") # parameter Ego_InitPosition_LaneId: string = '-4' Ego_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 5.0m, t: 0.0m) Ego_InitPosition: pose_3d with: keep(it.odr_point == Ego_Odr) TargetBlocking_InitPosition_Offset: length = -1.5m TargetBlocking_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 500.0m, t: TargetBlocking_InitPosition_Offset) TargetBlocking_InitPosition: pose_3d with: keep(it.odr_point == TargetBlocking_Odr) Ego_InitSpeed_Ve0: speed = 16.66666667mps Duration: time = 40s # entity Ego_Name: string = "Audi_A3_2009_black" Ego_Controller: string = "DefaultDriver" Ego: vehicle with: keep(it.name == Ego_Name) keep(it.initial_bm == Ego_Controller) TargetBlocking: person with: keep(it.name == "Christian") keep(it.model == "male_adult") # storyboard do parallel(duration: Duration): # init Ego.assign_init_position(position: Ego_InitPosition) Ego.assign_init_speed(Ego_InitSpeed_Ve0) TargetBlocking.assign_init_position(position: TargetBlocking_InitPosition) # act1: ActivateALKSControllerAct serial: wait elapsed(10000s) Ego.activate_controller(true, true) # args: lateral, longitudinal
转化结果
<OpenSCENARIO > <FileHeader author="Octopus/Simulation" date="2022-10-28T08:09:41" description="" revMajor="1" revMinor="0"/ > <CatalogLocations > <VehicleCatalog > <Directory path="Distros/Current/Config/Players/Vehicles"/ > </VehicleCatalog > <ControllerCatalog > <Directory path="Distros/Current/Config/Players/driverCfg.xml"/ > </ControllerCatalog > <PedestrianCatalog > <Directory path="Distros/Current/Config/Players/Pedestrians"/ > </PedestrianCatalog > <MiscObjectCatalog > <Directory path="Distros/Current/Config/Players/Objects"/ > </MiscObjectCatalog > </CatalogLocations > <RoadNetwork > <LogicFile filepath="./ALKS_Road.xodr"/ > <SceneGraphFile filepath=""/ > </RoadNetwork > <Entities > <ScenarioObject name="Ego" > <Vehicle name="Audi_A3_2009_black" vehicleCategory="car" > <BoundingBox > <Center x="1.5" y="0" z="0.9"/ > <Dimensions height="2.1" length="4.5" width="1.8"/ > </BoundingBox > <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/ > <Axles > <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > </Axles > <Properties > <Property name="control" value="external"/ > </Properties > </Vehicle > <ObjectController > <Controller name="DefaultDriver" > <Properties/ > </Controller > </ObjectController > </ScenarioObject > <ScenarioObject name="TargetBlocking" > <Pedestrian mass="80" model="male_adult" name="Christian" pedestrianCategory="pedestrian" > <BoundingBox > <Center x="1.5" y="0" z="0.9"/ > <Dimensions height="2.1" length="4.5" width="1.8"/ > </BoundingBox > <Properties/ > </Pedestrian > </ScenarioObject > </Entities > <Storyboard > <Init > <Actions > <Private entityRef="Ego" > <PrivateAction > <TeleportAction > <Position > <LanePosition laneId="-4" offset="0" roadId="0" s="5"/ > </Position > </TeleportAction > </PrivateAction > <PrivateAction > <LongitudinalAction > <SpeedAction > <SpeedActionDynamics dynamicsDimension="time" dynamicsShape="step" value="0"/ > <SpeedActionTarget > <AbsoluteTargetSpeed value="16.67"/ > </SpeedActionTarget > </SpeedAction > </LongitudinalAction > </PrivateAction > </Private > <Private entityRef="TargetBlocking" > <PrivateAction > <TeleportAction > <Position > <LanePosition laneId="-4" offset="-1.5" roadId="0" s="500"/ > </Position > </TeleportAction > </PrivateAction > </Private > </Actions > </Init > <Story name="PartiallyBlockingTargetStory" > <Act name="Ego_activate_controller_act" > <ManeuverGroup maximumExecutionCount="1" name="Ego_activate_controller_maneuvers" > <Actors selectTriggeringEntities="false" > <EntityRef entityRef="Ego"/ > </Actors > <Maneuver name="Ego_activate_controller_maneuver" > <Event maximumExecutionCount="1" name="Ego_activate_controller_event" priority="overwrite" > <Action name="Ego_activate_controller" > <PrivateAction > <ActivateControllerAction lateral="true" longitudinal="true"/ > </PrivateAction > </Action > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_condition_1" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="0"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Event > </Maneuver > </ManeuverGroup > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_condition" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="10000"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Act > </Story > <StopTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="story_end" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="40"/ > </ByValueCondition > </Condition > </ConditionGroup > </StopTrigger > </Storyboard > </OpenSCENARIO>
FollowLeadVehicleEmergencyBrake
简述:主车Ego和正前方33.33m的头车lead_vehicle按照相同的初始速度匀速行驶,前车突然刹车,10000s后激活Ego的controller,40s后停止场景(激活时间与场景停止时间可修改)。
osc2.0场景
import standard scenario FollowLeadVehicleEmergencyBrake: # map map: map map.set_map_file("./ALKS_Road.xodr") # parameter Ego_InitPosition_LaneId: string = '-4' m_odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 5.0m, t: 0.0m) Ego_InitPosition: pose_3d with: keep(it.odr_point == m_odr) Ego_InitSpeed_Ve0: speed = 16.66666667mps LeadVehicle_InitDistance_dx0: length = 33.33333333m LeadVehicle_BrakeRate_Gx_max: acceleration = 6.0mpss m_rate_profile: dynamics_shape = linear Duration: time = 40s # entity Ego_Name: string = "Audi_A3_2009_black" LeadVehicle_Name: string = "Audi_A3_2009_red" Ego_Controller: string = "DefaultDriver" Ego: vehicle with: keep(it.name == Ego_Name) keep(it.initial_bm == Ego_Controller) lead_vehicle: vehicle with: keep(it.name == LeadVehicle_Name) # storyboard do parallel(duration: Duration): # init Ego.assign_init_position(position: Ego_InitPosition) Ego.assign_init_speed(Ego_InitSpeed_Ve0) lead_vehicle.assign_init_position() with: lane(same_as: Ego) position(LeadVehicle_InitDistance_dx0, ahead_of: Ego) lead_vehicle.assign_init_speed(Ego_InitSpeed_Ve0) # act1: ActivateALKSControllerAct serial: wait elapsed(10000s) Ego.activate_controller(true, true) # args: lateral, longitudinal # act2: BrakeAct # VaryingSpeedEvent serial: wait elapsed(10s) lead_vehicle.change_speed(target: 0.0mps, rate_profile: m_rate_profile, rate_peak: LeadVehicle_BrakeRate_Gx_max)
转化结果
<OpenSCENARIO > <FileHeader author="Octopus/Simulation" date="2022-10-28T08:12:34" description="" revMajor="1" revMinor="0"/ > <CatalogLocations > <VehicleCatalog > <Directory path="Distros/Current/Config/Players/Vehicles"/ > </VehicleCatalog > <ControllerCatalog > <Directory path="Distros/Current/Config/Players/driverCfg.xml"/ > </ControllerCatalog > <PedestrianCatalog > <Directory path="Distros/Current/Config/Players/Pedestrians"/ > </PedestrianCatalog > <MiscObjectCatalog > <Directory path="Distros/Current/Config/Players/Objects"/ > </MiscObjectCatalog > </CatalogLocations > <RoadNetwork > <LogicFile filepath="./ALKS_Road.xodr"/ > <SceneGraphFile filepath=""/ > </RoadNetwork > <Entities > <ScenarioObject name="Ego" > <Vehicle name="Audi_A3_2009_black" vehicleCategory="car" > <BoundingBox > <Center x="1.5" y="0" z="0.9"/ > <Dimensions height="2.1" length="4.5" width="1.8"/ > </BoundingBox > <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/ > <Axles > <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > </Axles > <Properties > <Property name="control" value="external"/ > </Properties > </Vehicle > <ObjectController > <Controller name="DefaultDriver" > <Properties/ > </Controller > </ObjectController > </ScenarioObject > <ScenarioObject name="lead_vehicle" > <Vehicle name="Audi_A3_2009_red" vehicleCategory="car" > <BoundingBox > <Center x="1.5" y="0" z="0.9"/ > <Dimensions height="2.1" length="4.5" width="1.8"/ > </BoundingBox > <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/ > <Axles > <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > </Axles > <Properties/ > </Vehicle > </ScenarioObject > </Entities > <Storyboard > <Init > <Actions > <Private entityRef="Ego" > <PrivateAction > <TeleportAction > <Position > <LanePosition laneId="-4" offset="0" roadId="0" s="5"/ > </Position > </TeleportAction > </PrivateAction > <PrivateAction > <LongitudinalAction > <SpeedAction > <SpeedActionDynamics dynamicsDimension="time" dynamicsShape="step" value="0"/ > <SpeedActionTarget > <AbsoluteTargetSpeed value="16.66666667"/ > </SpeedActionTarget > </SpeedAction > </LongitudinalAction > </PrivateAction > </Private > <Private entityRef="lead_vehicle" > <PrivateAction > <TeleportAction > <Position > <RelativeLanePosition dLane="0" ds="33.33333333" entityRef="Ego"/ > </Position > </TeleportAction > </PrivateAction > <PrivateAction > <LongitudinalAction > <SpeedAction > <SpeedActionDynamics dynamicsDimension="time" dynamicsShape="step" value="0"/ > <SpeedActionTarget > <AbsoluteTargetSpeed value="16.66666667"/ > </SpeedActionTarget > </SpeedAction > </LongitudinalAction > </PrivateAction > </Private > </Actions > </Init > <Story name="FollowLeadVehicleEmergencyBrakeStory" > <Act name="Ego_activate_controller_7_act" > <ManeuverGroup maximumExecutionCount="1" name="Ego_activate_controller_7_maneuvers" > <Actors selectTriggeringEntities="false" > <EntityRef entityRef="Ego"/ > </Actors > <Maneuver name="Ego_activate_controller_7_maneuver" > <Event maximumExecutionCount="1" name="Ego_activate_controller_7_event" priority="overwrite" > <Action name="Ego_activate_controller_7" > <PrivateAction > <ActivateControllerAction lateral="true" longitudinal="true"/ > </PrivateAction > </Action > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_7_condition_1" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="0"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Event > </Maneuver > </ManeuverGroup > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_7_condition" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="10000"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Act > <Act name="lead_vehicle_change_speed_1_act" > <ManeuverGroup maximumExecutionCount="1" name="lead_vehicle_change_speed_1_maneuvers" > <Actors selectTriggeringEntities="false" > <EntityRef entityRef="lead_vehicle"/ > </Actors > <Maneuver name="lead_vehicle_change_speed_1_maneuver" > <Event maximumExecutionCount="1" name="lead_vehicle_change_speed_1_event" priority="overwrite" > <Action name="lead_vehicle_change_speed_1" > <PrivateAction > <LongitudinalAction > <SpeedAction > <SpeedActionDynamics dynamicsDimension="rate" dynamicsShape="linear" value="6"/ > <SpeedActionTarget > <AbsoluteTargetSpeed value="0"/ > </SpeedActionTarget > </SpeedAction > </LongitudinalAction > </PrivateAction > </Action > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="lead_vehicle_change_speed_1_condition_1" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="0"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Event > </Maneuver > </ManeuverGroup > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="lead_vehicle_change_speed_1_condition" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="10"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Act > </Story > <StopTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="story_end" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="40"/ > </ByValueCondition > </Condition > </ConditionGroup > </StopTrigger > </Storyboard > </OpenSCENARIO>
CutInNoCollision
简述:主车Ego按照初始速度16.667mps匀速行驶,前方85m右1车道的切入车辆cut_in_vehicle以慢于Ego5.55mps的速度行驶,当两车距离小于30m时,cut_in_vehicle开始以15mps为目标加速(加速动态受到加速度值CutInVehicle_SpeedChange_RatePeak的影响,此处ALKS设置的默认加速度为0.0mps,可以根据需要更改),同时变道切入Ego所在车道,10000s后激活Ego的controller,40s后停止场景(激活时间与场景停止时间可修改)。
osc2.0场景
import standard scenario CutInNoCollision: # map map: map map.set_map_file('./ALKS_Road.xodr') # parameter m_odr: odr_point = map.create_odr_point(road_id: '0', lane_id: '-4', s: 5.0m, t: 0.0m) Ego_InitPosition: pose_3d with: keep(it.odr_point == m_odr) Ego_InitSpeed_Ve0: speed = 16.66666667mps CutInVehicle_InitPosition_RelativeLaneId: int = 1 # -1 for right, 1 for left CutInVehicle_HeadwayDistanceTrigger_dx0: length = 30.0m CutInVehicle_LaneChange_MaxLateralVelocity_Vy: speed = 2.0mps CutInVehicle_SpeedChange_RatePeak: acceleration = 0.0mpss CutInVehicle_Acceleration_Target: speed = 15.0mps m_right: side_left_right = right m_direction: distance_direction = longitudinal m_mode: distance_mode = bounding_boxes m_side: lane_change_side = same m_rate_profile_lane: dynamics_shape = linear m_rate_profile_speed: dynamics_shape = linear Duration: time = 40s # entity Ego_Name: string = "Audi_A3_2009_black" CutInVehicle_Name: string = "Audi_A3_2009_red" Ego_Controller: string = "DefaultDriver" Ego: vehicle with: keep(it.name == Ego_Name) keep(it.initial_bm == Ego_Controller) cut_in_vehicle: vehicle with: keep(it.name == CutInVehicle_Name) # storyboard do parallel(duration: Duration): # init Ego.assign_init_position(position: Ego_InitPosition) Ego.assign_init_speed(target: Ego_InitSpeed_Ve0) cut_in_vehicle.assign_init_position() with: lane(lane: CutInVehicle_InitPosition_RelativeLaneId, side_of: Ego, side: m_right) position(distance: 85.0m, ahead_of: Ego) cut_in_vehicle.assign_init_speed(11.1111mps) # story serial: # act1: ActivateALKSControllerAct wait elapsed(10000s) Ego.activate_controller(lateral: true, longitudinal: true) serial: # act2: CutInAct wait cut_in_vehicle.object_distance(reference: Ego, direction: m_direction, mode: m_mode) < CutInVehicle_HeadwayDistanceTrigger_dx0 parallel: cut_in_vehicle.change_lane(side: m_side, reference: Ego, rate_peak: CutInVehicle_LaneChange_MaxLateralVelocity_Vy, rate_profile: m_rate_profile_lane) cut_in_vehicle.change_speed(target: CutInVehicle_Acceleration_Target, rate_peak: CutInVehicle_SpeedChange_RatePeak, rate_profile: m_rate_profile_speed)
转化结果
<OpenSCENARIO > <FileHeader author="Octopus/Simulation" date="2022-10-28T08:55:16" description="" revMajor="1" revMinor="0"/ > <CatalogLocations > <VehicleCatalog > <Directory path="Distros/Current/Config/Players/Vehicles"/ > </VehicleCatalog > <ControllerCatalog > <Directory path="Distros/Current/Config/Players/driverCfg.xml"/ > </ControllerCatalog > <PedestrianCatalog > <Directory path="Distros/Current/Config/Players/Pedestrians"/ > </PedestrianCatalog > <MiscObjectCatalog > <Directory path="Distros/Current/Config/Players/Objects"/ > </MiscObjectCatalog > </CatalogLocations > <RoadNetwork > <LogicFile filepath="./ALKS_Road.xodr"/ > <SceneGraphFile filepath=""/ > </RoadNetwork > <Entities > <ScenarioObject name="Ego" > <Vehicle name="Audi_A3_2009_black" vehicleCategory="car" > <BoundingBox > <Center x="1.5" y="0" z="0.9"/ > <Dimensions height="2.1" length="4.5" width="1.8"/ > </BoundingBox > <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/ > <Axles > <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > </Axles > <Properties > <Property name="control" value="external"/ > </Properties > </Vehicle > <ObjectController > <Controller name="DefaultDriver" > <Properties/ > </Controller > </ObjectController > </ScenarioObject > <ScenarioObject name="cut_in_vehicle" > <Vehicle name="Audi_A3_2009_red" vehicleCategory="car" > <BoundingBox > <Center x="1.5" y="0" z="0.9"/ > <Dimensions height="2.1" length="4.5" width="1.8"/ > </BoundingBox > <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/ > <Axles > <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > </Axles > <Properties/ > </Vehicle > </ScenarioObject > </Entities > <Storyboard > <Init > <Actions > <Private entityRef="Ego" > <PrivateAction > <TeleportAction > <Position > <LanePosition laneId="-4" offset="0" roadId="0" s="5"/ > </Position > </TeleportAction > </PrivateAction > <PrivateAction > <LongitudinalAction > <SpeedAction > <SpeedActionDynamics dynamicsDimension="time" dynamicsShape="step" value="0"/ > <SpeedActionTarget > <AbsoluteTargetSpeed value="16.67"/ > </SpeedActionTarget > </SpeedAction > </LongitudinalAction > </PrivateAction > </Private > <Private entityRef="cut_in_vehicle" > <PrivateAction > <TeleportAction > <Position > <RelativeLanePosition dLane="-1" ds="85" entityRef="Ego"/ > </Position > </TeleportAction > </PrivateAction > <PrivateAction > <LongitudinalAction > <SpeedAction > <SpeedActionDynamics dynamicsDimension="time" dynamicsShape="step" value="0"/ > <SpeedActionTarget > <AbsoluteTargetSpeed value="11.11"/ > </SpeedActionTarget > </SpeedAction > </LongitudinalAction > </PrivateAction > </Private > </Actions > </Init > <Story name="CutInNoCollisionStory" > <Act name="Ego_activate_controller_act" > <ManeuverGroup maximumExecutionCount="1" name="Ego_activate_controller_maneuvers" > <Actors selectTriggeringEntities="false" > <EntityRef entityRef="Ego"/ > </Actors > <Maneuver name="Ego_activate_controller_maneuver" > <Event maximumExecutionCount="1" name="Ego_activate_controller_event" priority="overwrite" > <Action name="Ego_activate_controller" > <PrivateAction > <ActivateControllerAction lateral="true" longitudinal="true"/ > </PrivateAction > </Action > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_condition_1" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="0"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Event > </Maneuver > </ManeuverGroup > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_condition" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="10000"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Act > <Act name="cut_in_vehicle_change_lane_act" > <ManeuverGroup maximumExecutionCount="1" name="cut_in_vehicle_change_lane_maneuvers" > <Actors selectTriggeringEntities="false" > <EntityRef entityRef="cut_in_vehicle"/ > </Actors > <Maneuver name="cut_in_vehicle_change_lane_maneuver" > <Event maximumExecutionCount="1" name="cut_in_vehicle_change_lane_event" priority="overwrite" > <Action name="cut_in_vehicle_change_lane" > <PrivateAction > <LateralAction > <LaneChangeAction > <LaneChangeActionDynamics dynamicsDimension="rate" dynamicsShape="linear" value="2"/ > <LaneChangeTarget > <RelativeTargetLane entityRef="Ego" value="0"/ > </LaneChangeTarget > </LaneChangeAction > </LateralAction > </PrivateAction > </Action > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="cut_in_vehicle_change_lane_condition" > <ByEntityCondition > <TriggeringEntities triggeringEntitiesRule="any" > <EntityRef entityRef="cut_in_vehicle"/ > </TriggeringEntities > <EntityCondition > <DistanceCondition alongRoute="true" freespace="true" rule="lessThan" value="30" > <Position > <RelativeObjectPosition dx="0" dy="0" dz="0" entityRef="Ego" > <Orientation h="0" p="0" r="0" type="absolute"/ > </RelativeObjectPosition > </Position > </DistanceCondition > </EntityCondition > </ByEntityCondition > </Condition > </ConditionGroup > </StartTrigger > </Event > </Maneuver > </ManeuverGroup > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="cut_in_vehicle_change_lane_condition_1" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="0"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Act > <Act name="cut_in_vehicle_change_speed_act" > <ManeuverGroup maximumExecutionCount="1" name="cut_in_vehicle_change_speed_maneuvers" > <Actors selectTriggeringEntities="false" > <EntityRef entityRef="cut_in_vehicle"/ > </Actors > <Maneuver name="cut_in_vehicle_change_speed_maneuver" > <Event maximumExecutionCount="1" name="cut_in_vehicle_change_speed_event" priority="overwrite" > <Action name="cut_in_vehicle_change_speed" > <PrivateAction > <LongitudinalAction > <SpeedAction > <SpeedActionDynamics dynamicsDimension="rate" dynamicsShape="linear" value="0"/ > <SpeedActionTarget > <AbsoluteTargetSpeed value="15"/ > </SpeedActionTarget > </SpeedAction > </LongitudinalAction > </PrivateAction > </Action > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="cut_in_vehicle_change_speed_condition" > <ByEntityCondition > <TriggeringEntities triggeringEntitiesRule="any" > <EntityRef entityRef="cut_in_vehicle"/ > </TriggeringEntities > <EntityCondition > <DistanceCondition alongRoute="true" freespace="true" rule="lessThan" value="30" > <Position > <RelativeObjectPosition dx="0" dy="0" dz="0" entityRef="Ego" > <Orientation h="0" p="0" r="0" type="absolute"/ > </RelativeObjectPosition > </Position > </DistanceCondition > </EntityCondition > </ByEntityCondition > </Condition > </ConditionGroup > </StartTrigger > </Event > </Maneuver > </ManeuverGroup > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="cut_in_vehicle_change_speed_condition_1" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="0"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Act > </Story > <StopTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="story_end" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="40"/ > </ByValueCondition > </Condition > </ConditionGroup > </StopTrigger > </Storyboard > </OpenSCENARIO>
CutInUnavoidableCollision
简述:主车Ego按照初始速度16.667mps匀速行驶,前方55m右1车道的切入车辆cut_in_vehicle以慢于Ego5.55mps的速度行驶,当两车距离小于10m时,cut_in_vehicle开始以15mps为目标加速,同时变道切入Ego所在车道,10000s后激活Ego的controller,40s后停止场景(激活时间与场景停止时间可修改)。
osc2.0场景
import standard scenario CutInUnavoidableCollision: # map map: map map.set_map_file("./ALKS_Road.xodr") # parameter m_odr: odr_point = map.create_odr_point(road_id: '0', lane_id: '-4', s: 5.0m, t: 0.0m) Ego_InitPosition: pose_3d with: keep(it.odr_point == m_odr) Ego_InitSpeed_Ve0: speed = 16.66666667mps CutInVehicle_InitPosition_RelativeLaneId: int = 1 # -1 for right, 1 for left CutInVehicle_HeadwayDistanceTrigger_dx0: length = 10.0m CutInVehicle_LaneChange_MaxLateralVelocity_Vy: speed = 3.0mps CutInVehicle_SpeedChange_RatePeak: acceleration = 0.0mpss CutInVehicle_Acceleration_Target: speed = 15.0mps CutInVehicle_SpeedChange_RateProfile: dynamics_shape = linear m_right: side_left_right = right m_direction: distance_direction = longitudinal m_mode: distance_mode = bounding_boxes m_side: lane_change_side = same m_rate_profile_lane: dynamics_shape = linear m_rate_profile_speed: dynamics_shape = linear Duration: time = 40s # entity Ego_Name: string = "Audi_A3_2009_black" CutInVehicle_Name: string = "Audi_A3_2009_red" Ego_Controller: string = "DefaultDriver" Ego: vehicle with: keep(it.name == Ego_Name) keep(it.initial_bm == Ego_Controller) cut_in_vehicle: vehicle with: keep(it.name == CutInVehicle_Name) # storyboard do parallel(duration: Duration): # init Ego.assign_init_position(position: Ego_InitPosition) Ego.assign_init_speed(Ego_InitSpeed_Ve0) cut_in_vehicle.assign_init_position() with: lane(lane: CutInVehicle_InitPosition_RelativeLaneId, side_of: Ego, side: m_right) position(distance: 55.0m, ahead_of: Ego) cut_in_vehicle.assign_init_speed(11.1111mps) # story serial: # act1: ActivateALKSControllerAct wait elapsed(10000s) Ego.activate_controller(true, true) # lateral, longitudinal # act 1: ActivateALKSControllerStory serial: # act2: CutInAct wait cut_in_vehicle.object_distance(reference: Ego, direction: m_direction, mode: m_mode) < CutInVehicle_HeadwayDistanceTrigger_dx0 parallel: cut_in_vehicle.change_lane(side: m_side, reference: Ego, rate_peak: CutInVehicle_LaneChange_MaxLateralVelocity_Vy, rate_profile: m_rate_profile_lane) cut_in_vehicle.change_speed(target: CutInVehicle_Acceleration_Target, rate_peak: CutInVehicle_SpeedChange_RatePeak, rate_profile: m_rate_profile_speed)
转化结果
<OpenSCENARIO > <FileHeader author="Octopus/Simulation" date="2022-10-28T09:18:33" description="" revMajor="1" revMinor="0"/ > <CatalogLocations > <VehicleCatalog > <Directory path="Distros/Current/Config/Players/Vehicles"/ > </VehicleCatalog > <ControllerCatalog > <Directory path="Distros/Current/Config/Players/driverCfg.xml"/ > </ControllerCatalog > <PedestrianCatalog > <Directory path="Distros/Current/Config/Players/Pedestrians"/ > </PedestrianCatalog > <MiscObjectCatalog > <Directory path="Distros/Current/Config/Players/Objects"/ > </MiscObjectCatalog > </CatalogLocations > <RoadNetwork > <LogicFile filepath="./ALKS_Road.xodr"/ > <SceneGraphFile filepath=""/ > </RoadNetwork > <Entities > <ScenarioObject name="Ego" > <Vehicle name="Audi_A3_2009_black" vehicleCategory="car" > <BoundingBox > <Center x="1.5" y="0" z="0.9"/ > <Dimensions height="2.1" length="4.5" width="1.8"/ > </BoundingBox > <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/ > <Axles > <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > </Axles > <Properties > <Property name="control" value="external"/ > </Properties > </Vehicle > <ObjectController > <Controller name="DefaultDriver" > <Properties/ > </Controller > </ObjectController > </ScenarioObject > <ScenarioObject name="cut_in_vehicle" > <Vehicle name="Audi_A3_2009_red" vehicleCategory="car" > <BoundingBox > <Center x="1.5" y="0" z="0.9"/ > <Dimensions height="2.1" length="4.5" width="1.8"/ > </BoundingBox > <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/ > <Axles > <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/ > </Axles > <Properties/ > </Vehicle > </ScenarioObject > </Entities > <Storyboard > <Init > <Actions > <Private entityRef="Ego" > <PrivateAction > <TeleportAction > <Position > <LanePosition laneId="-4" offset="0" roadId="0" s="5"/ > </Position > </TeleportAction > </PrivateAction > <PrivateAction > <LongitudinalAction > <SpeedAction > <SpeedActionDynamics dynamicsDimension="time" dynamicsShape="step" value="0"/ > <SpeedActionTarget > <AbsoluteTargetSpeed value="16.66666667"/ > </SpeedActionTarget > </SpeedAction > </LongitudinalAction > </PrivateAction > </Private > <Private entityRef="cut_in_vehicle" > <PrivateAction > <TeleportAction > <Position > <RelativeLanePosition dLane="-1" ds="55" entityRef="Ego"/ > </Position > </TeleportAction > </PrivateAction > <PrivateAction > <LongitudinalAction > <SpeedAction > <SpeedActionDynamics dynamicsDimension="time" dynamicsShape="step" value="0"/ > <SpeedActionTarget > <AbsoluteTargetSpeed value="11.1111"/ > </SpeedActionTarget > </SpeedAction > </LongitudinalAction > </PrivateAction > </Private > </Actions > </Init > <Story name="CutInUnavoidableCollisionStory" > <Act name="Ego_activate_controller_7_act" > <ManeuverGroup maximumExecutionCount="1" name="Ego_activate_controller_7_maneuvers" > <Actors selectTriggeringEntities="false" > <EntityRef entityRef="Ego"/ > </Actors > <Maneuver name="Ego_activate_controller_7_maneuver" > <Event maximumExecutionCount="1" name="Ego_activate_controller_7_event" priority="overwrite" > <Action name="Ego_activate_controller_7" > <PrivateAction > <ActivateControllerAction lateral="true" longitudinal="true"/ > </PrivateAction > </Action > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_7_condition_1" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="0"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Event > </Maneuver > </ManeuverGroup > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_7_condition" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="10000"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Act > <Act name="cut_in_vehicle_change_lane_act" > <ManeuverGroup maximumExecutionCount="1" name="cut_in_vehicle_change_lane_maneuvers" > <Actors selectTriggeringEntities="false" > <EntityRef entityRef="cut_in_vehicle"/ > </Actors > <Maneuver name="cut_in_vehicle_change_lane_maneuver" > <Event maximumExecutionCount="1" name="cut_in_vehicle_change_lane_event" priority="overwrite" > <Action name="cut_in_vehicle_change_lane" > <PrivateAction > <LateralAction > <LaneChangeAction > <LaneChangeActionDynamics dynamicsDimension="rate" dynamicsShape="linear" value="3"/ > <LaneChangeTarget > <RelativeTargetLane entityRef="Ego" value="0"/ > </LaneChangeTarget > </LaneChangeAction > </LateralAction > </PrivateAction > </Action > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="cut_in_vehicle_change_lane_condition" > <ByEntityCondition > <TriggeringEntities triggeringEntitiesRule="any" > <EntityRef entityRef="cut_in_vehicle"/ > </TriggeringEntities > <EntityCondition > <DistanceCondition alongRoute="true" freespace="true" rule="lessThan" value="10" > <Position > <RelativeObjectPosition dx="0" dy="0" dz="0" entityRef="Ego" > <Orientation h="0" p="0" r="0" type="absolute"/ > </RelativeObjectPosition > </Position > </DistanceCondition > </EntityCondition > </ByEntityCondition > </Condition > </ConditionGroup > </StartTrigger > </Event > </Maneuver > </ManeuverGroup > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="cut_in_vehicle_change_lane_condition_1" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="0"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Act > <Act name="cut_in_vehicle_change_speed_act" > <ManeuverGroup maximumExecutionCount="1" name="cut_in_vehicle_change_speed_maneuvers" > <Actors selectTriggeringEntities="false" > <EntityRef entityRef="cut_in_vehicle"/ > </Actors > <Maneuver name="cut_in_vehicle_change_speed_maneuver" > <Event maximumExecutionCount="1" name="cut_in_vehicle_change_speed_event" priority="overwrite" > <Action name="cut_in_vehicle_change_speed" > <PrivateAction > <LongitudinalAction > <SpeedAction > <SpeedActionDynamics dynamicsDimension="rate" dynamicsShape="linear" value="0"/ > <SpeedActionTarget > <AbsoluteTargetSpeed value="15"/ > </SpeedActionTarget > </SpeedAction > </LongitudinalAction > </PrivateAction > </Action > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="cut_in_vehicle_change_speed_condition" > <ByEntityCondition > <TriggeringEntities triggeringEntitiesRule="any" > <EntityRef entityRef="cut_in_vehicle"/ > </TriggeringEntities > <EntityCondition > <DistanceCondition alongRoute="true" freespace="true" rule="lessThan" value="10" > <Position > <RelativeObjectPosition dx="0" dy="0" dz="0" entityRef="Ego" > <Orientation h="0" p="0" r="0" type="absolute"/ > </RelativeObjectPosition > </Position > </DistanceCondition > </EntityCondition > </ByEntityCondition > </Condition > </ConditionGroup > </StartTrigger > </Event > </Maneuver > </ManeuverGroup > <StartTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="cut_in_vehicle_change_speed_condition_1" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="0"/ > </ByValueCondition > </Condition > </ConditionGroup > </StartTrigger > </Act > </Story > <StopTrigger > <ConditionGroup > <Condition conditionEdge="rising" delay="0" name="story_end" > <ByValueCondition > <SimulationTimeCondition rule="greaterThan" value="40"/ > </ByValueCondition > </Condition > </ConditionGroup > </StopTrigger > </Storyboard > </OpenSCENARIO>
CutOutFullyBlocking
简述:主车Ego与同车道前方33.33m的头车lead_vehicle都按照初始速度16.667mps匀速行驶,正前方约500m处有一个行人target_blocking,lead_vehicle在与行人距离小于50m时往左变道躲避行人,10000s后激活Ego的controller,40s后停止场景(激活时间与场景停止时间可修改)。
osc2.0场景
import standard scenario CutOutFullyBlocking: # map map: map map.set_map_file("./ALKS_Road.xodr") # parameter Ego_InitPosition_LaneId: string = '-4' Ego_InitSpeed_Ve0: speed = 16.66666667mps LeadVehicle_InitDistance_dx0: length = 38.33333333m Ego_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 5.0m, t: 0.0m) Ego_InitPosition: pose_3d with: keep(it.odr_point == Ego_Odr) Blocking_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 500.0m, t: 0.0m) Blocking_InitPosition: pose_3d with: keep(it.odr_point == Blocking_Odr) LeadVehicle_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: LeadVehicle_InitDistance_dx0, t: 0.0m) LeadVehicle_InitPosition: pose_3d with: keep(it.odr_point == LeadVehicle_Odr) FrontOfLead_Distance_dx0_f: length = 50.0m Lateral_Velocity_Vy: speed = 2.0mps m_direction : distance_direction = longitudinal m_mode : distance_mode = bounding_boxes m_rate_profile: dynamics_shape = linear m_side: lane_change_side = left Duration: time = 40s # entity Ego_Name: string = "Audi_A3_2009_black" LeadVehicle_Name: string = "Audi_A3_2009_red" Ego_Controller: string = "DefaultDriver" Ego: vehicle with: keep(it.name == Ego_Name) keep(it.initial_bm == Ego_Controller) target_blocking: person with: keep(it.name == "Christian") keep(it.model == "male_adult") lead_vehicle: vehicle with: keep(it.name == LeadVehicle_Name) # storyboard do parallel(duration: Duration): # init Ego.assign_init_position(position: Ego_InitPosition) Ego.assign_init_speed(Ego_InitSpeed_Ve0) target_blocking.assign_init_position(position: Blocking_InitPosition) lead_vehicle.assign_init_position(position: LeadVehicle_InitPosition) lead_vehicle.assign_init_speed(Ego_InitSpeed_Ve0) serial: # act1: ActivateALKSControllerAct wait elapsed(10000s) Ego.activate_controller(true, true) # lateral, longitudinal serial: # act2: CutOutAct wait lead_vehicle.object_distance(reference: target_blocking, direction: m_direction, mode: m_mode) < FrontOfLead_Distance_dx0_f lead_vehicle.change_lane(number_of_lanes: 1, side: m_side, reference: lead_vehicle, rate_peak: Lateral_Velocity_Vy, rate_profile: m_rate_profile)
转化结果
<OpenSCENARIO> <FileHeader author="Octopus/Simulation" date="2022-10-29T01:31:30" description="" revMajor="1" revMinor="0"/> <CatalogLocations> <VehicleCatalog> <Directory path="Distros/Current/Config/Players/Vehicles"/> </VehicleCatalog> <ControllerCatalog> <Directory path="Distros/Current/Config/Players/driverCfg.xml"/> </ControllerCatalog> <PedestrianCatalog> <Directory path="Distros/Current/Config/Players/Pedestrians"/> </PedestrianCatalog> <MiscObjectCatalog> <Directory path="Distros/Current/Config/Players/Objects"/> </MiscObjectCatalog> </CatalogLocations> <RoadNetwork> <LogicFile filepath="./ALKS_Road.xodr"/> <SceneGraphFile filepath=""/> </RoadNetwork> <Entities> <ScenarioObject name="Ego"> <Vehicle name="Audi_A3_2009_black" vehicleCategory="car"> <BoundingBox> <Center x="1.5" y="0" z="0.9"/> <Dimensions height="2.1" length="4.5" width="1.8"/> </BoundingBox> <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/> <Axles> <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/> <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/> </Axles> <Properties> <Property name="control" value="external"/> </Properties> </Vehicle> <ObjectController> <Controller name="DefaultDriver"> <Properties/> </Controller> </ObjectController> </ScenarioObject> <ScenarioObject name="lead_vehicle"> <Vehicle name="Audi_A3_2009_red" vehicleCategory="car"> <BoundingBox> <Center x="1.5" y="0" z="0.9"/> <Dimensions height="2.1" length="4.5" width="1.8"/> </BoundingBox> <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/> <Axles> <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/> <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/> </Axles> <Properties/> </Vehicle> </ScenarioObject> <ScenarioObject name="target_blocking"> <Pedestrian mass="80" model="male_adult" name="Christian" pedestrianCategory="pedestrian"> <BoundingBox> <Center x="1.5" y="0" z="0.9"/> <Dimensions height="2.1" length="4.5" width="1.8"/> </BoundingBox> <Properties/> </Pedestrian> </ScenarioObject> </Entities> <Storyboard> <Init> <Actions> <Private entityRef="Ego"> <PrivateAction> <TeleportAction> <Position> <LanePosition laneId="-4" offset="0" roadId="0" s="5"/> </Position> </TeleportAction> </PrivateAction> <PrivateAction> <LongitudinalAction> <SpeedAction> <SpeedActionDynamics dynamicsDimension="time" dynamicsShape="step" value="0"/> <SpeedActionTarget> <AbsoluteTargetSpeed value="16.66666667"/> </SpeedActionTarget> </SpeedAction> </LongitudinalAction> </PrivateAction> </Private> <Private entityRef="lead_vehicle"> <PrivateAction> <TeleportAction> <Position> <LanePosition laneId="-4" offset="0" roadId="0" s="38.33333333"/> </Position> </TeleportAction> </PrivateAction> <PrivateAction> <LongitudinalAction> <SpeedAction> <SpeedActionDynamics dynamicsDimension="time" dynamicsShape="step" value="0"/> <SpeedActionTarget> <AbsoluteTargetSpeed value="16.66666667"/> </SpeedActionTarget> </SpeedAction> </LongitudinalAction> </PrivateAction> </Private> <Private entityRef="target_blocking"> <PrivateAction> <TeleportAction> <Position> <LanePosition laneId="-4" offset="0" roadId="0" s="500"/> </Position> </TeleportAction> </PrivateAction> </Private> </Actions> </Init> <Story name="CutOutFullyBlockingStory"> <Act name="Ego_activate_controller_4_act"> <ManeuverGroup maximumExecutionCount="1" name="Ego_activate_controller_4_maneuvers"> <Actors selectTriggeringEntities="false"> <EntityRef entityRef="Ego"/> </Actors> <Maneuver name="Ego_activate_controller_4_maneuver"> <Event maximumExecutionCount="1" name="Ego_activate_controller_4_event" priority="overwrite"> <Action name="Ego_activate_controller_4"> <PrivateAction> <ActivateControllerAction lateral="true" longitudinal="true"/> </PrivateAction> </Action> <StartTrigger> <ConditionGroup> <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_4_condition_1"> <ByValueCondition> <SimulationTimeCondition rule="greaterThan" value="0"/> </ByValueCondition> </Condition> </ConditionGroup> </StartTrigger> </Event> </Maneuver> </ManeuverGroup> <StartTrigger> <ConditionGroup> <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_4_condition"> <ByValueCondition> <SimulationTimeCondition rule="greaterThan" value="10000"/> </ByValueCondition> </Condition> </ConditionGroup> </StartTrigger> </Act> <Act name="lead_vehicle_change_lane_act"> <ManeuverGroup maximumExecutionCount="1" name="lead_vehicle_change_lane_maneuvers"> <Actors selectTriggeringEntities="false"> <EntityRef entityRef="lead_vehicle"/> </Actors> <Maneuver name="lead_vehicle_change_lane_maneuver"> <Event maximumExecutionCount="1" name="lead_vehicle_change_lane_event" priority="overwrite"> <Action name="lead_vehicle_change_lane"> <PrivateAction> <LateralAction> <LaneChangeAction> <LaneChangeActionDynamics dynamicsDimension="rate" dynamicsShape="linear" value="2"/> <LaneChangeTarget> <RelativeTargetLane entityRef="lead_vehicle" value="1"/> </LaneChangeTarget> </LaneChangeAction> </LateralAction> </PrivateAction> </Action> <StartTrigger> <ConditionGroup> <Condition conditionEdge="rising" delay="0" name="lead_vehicle_change_lane_condition"> <ByEntityCondition> <TriggeringEntities triggeringEntitiesRule="any"> <EntityRef entityRef="lead_vehicle"/> </TriggeringEntities> <EntityCondition> <DistanceCondition alongRoute="true" freespace="true" rule="lessThan" value="50"> <Position> <RelativeObjectPosition dx="0" dy="0" dz="0" entityRef="target_blocking"> <Orientation h="0" p="0" r="0" type="absolute"/> </RelativeObjectPosition> </Position> </DistanceCondition> </EntityCondition> </ByEntityCondition> </Condition> </ConditionGroup> </StartTrigger> </Event> </Maneuver> </ManeuverGroup> <StartTrigger> <ConditionGroup> <Condition conditionEdge="rising" delay="0" name="lead_vehicle_change_lane_condition_1"> <ByValueCondition> <SimulationTimeCondition rule="greaterThan" value="0"/> </ByValueCondition> </Condition> </ConditionGroup> </StartTrigger> </Act> </Story> <StopTrigger> <ConditionGroup> <Condition conditionEdge="rising" delay="0" name="story_end"> <ByValueCondition> <SimulationTimeCondition rule="greaterThan" value="40"/> </ByValueCondition> </Condition> </ConditionGroup> </StopTrigger> </Storyboard> </OpenSCENARIO>
CutOutMultipleBlockingTargets
简述:主车Ego与同车道前方33.33m的头车lead_vehicle都按照初始速度16.667mps匀速行驶,正前方约500m处有一个行人target_blocking1,约515m处有一个障碍车辆target_blocking2,lead_vehicle在与行人target_blocking1距离小于50m时往左变道避障,10000s后激活Ego的controller,40s后停止场景(激活时间与场景停止时间可修改)。
osc2.0场景
import standard scenario CutOutMultipleBlockingTargets: # map map: map map.set_map_file("./ALKS_Road.xodr") # parameter Ego_InitPosition_LaneId: string = "-4" Ego_InitSpeed_Ve0: speed = 16.66666667mps LeadVehicle_InitDistance_dx0: length = 38.33333333m Ego_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 5.0m, t: 0.0m) Ego_InitPosition: pose_3d with: keep(it.odr_point == Ego_Odr) Blocking1_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 500.0m, t: 0.0m) Blocking1_InitPosition: pose_3d with: keep(it.odr_point == Blocking1_Odr) Blocking2_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 515.0m, t: 0.0m) Blocking2_InitPosition: pose_3d with: keep(it.odr_point == Blocking2_Odr) LeadVehicle_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: LeadVehicle_InitDistance_dx0, t: 0.0m) LeadVehicle_InitPosition: pose_3d with: keep(it.odr_point == LeadVehicle_Odr) FrontOfLead_Distance_dx0_f: length = 50.0m Lateral_Velocity_Vy: speed = 2.0mps m_direction : distance_direction = longitudinal m_mode : distance_mode = bounding_boxes m_rate_profile: dynamics_shape = linear m_side: lane_change_side = left Duration: time = 40s # entity Ego_Name: string = "Audi_A3_2009_black" LeadVehicle_Name: string = "Audi_A3_2009_red" TargetBlocking2_Name: string = "Audi_A3_2009_blue" Ego_Controller: string = "DefaultDriver" Ego: vehicle with: keep(it.name == Ego_Name) keep(it.initial_bm == Ego_Controller) target_blocking1: person with: keep(it.name == "Christian") keep(it.model == "male_adult") target_blocking2: vehicle with: keep(it.name == TargetBlocking2_Name) lead_vehicle: vehicle with: keep(it.name == LeadVehicle_Name) # storyboard do parallel(duration: Duration): # init Ego.assign_init_position(position: Ego_InitPosition) Ego.assign_init_speed(Ego_InitSpeed_Ve0) target_blocking1.assign_init_position(position: Blocking1_InitPosition) target_blocking2.assign_init_position(position: Blocking2_InitPosition) lead_vehicle.assign_init_position(position: LeadVehicle_InitPosition) lead_vehicle.assign_init_speed(Ego_InitSpeed_Ve0) serial: # act1: ActivateALKSControllerAct wait elapsed(10000s) Ego.activate_controller(true, true) # lateral, longitudinal serial: # act2: CutOutAct wait lead_vehicle.object_distance(reference: target_blocking1, direction: m_direction, mode: m_mode) < FrontOfLead_Distance_dx0_f lead_vehicle.change_lane(number_of_lanes: 1, side: m_side, reference: lead_vehicle, rate_peak: Lateral_Velocity_Vy, rate_profile: m_rate_profile)
转化结果
<OpenSCENARIO> <FileHeader author="Octopus/Simulation" date="2022-10-29T01:26:41" description="" revMajor="1" revMinor="0"/> <CatalogLocations> <VehicleCatalog> <Directory path="Distros/Current/Config/Players/Vehicles"/> </VehicleCatalog> <ControllerCatalog> <Directory path="Distros/Current/Config/Players/driverCfg.xml"/> </ControllerCatalog> <PedestrianCatalog> <Directory path="Distros/Current/Config/Players/Pedestrians"/> </PedestrianCatalog> <MiscObjectCatalog> <Directory path="Distros/Current/Config/Players/Objects"/> </MiscObjectCatalog> </CatalogLocations> <RoadNetwork> <LogicFile filepath="./ALKS_Road.xodr"/> <SceneGraphFile filepath=""/> </RoadNetwork> <Entities> <ScenarioObject name="Ego"> <Vehicle name="Audi_A3_2009_black" vehicleCategory="car"> <BoundingBox> <Center x="1.5" y="0" z="0.9"/> <Dimensions height="2.1" length="4.5" width="1.8"/> </BoundingBox> <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/> <Axles> <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/> <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/> </Axles> <Properties> <Property name="control" value="external"/> </Properties> </Vehicle> <ObjectController> <Controller name="DefaultDriver"> <Properties/> </Controller> </ObjectController> </ScenarioObject> <ScenarioObject name="lead_vehicle"> <Vehicle name="Audi_A3_2009_red" vehicleCategory="car"> <BoundingBox> <Center x="1.5" y="0" z="0.9"/> <Dimensions height="2.1" length="4.5" width="1.8"/> </BoundingBox> <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/> <Axles> <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/> <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/> </Axles> <Properties/> </Vehicle> </ScenarioObject> <ScenarioObject name="target_blocking1"> <Pedestrian mass="80" model="male_adult" name="Christian" pedestrianCategory="pedestrian"> <BoundingBox> <Center x="1.5" y="0" z="0.9"/> <Dimensions height="2.1" length="4.5" width="1.8"/> </BoundingBox> <Properties/> </Pedestrian> </ScenarioObject> <ScenarioObject name="target_blocking2"> <Vehicle name="Audi_A3_2009_blue" vehicleCategory="car"> <BoundingBox> <Center x="1.5" y="0" z="0.9"/> <Dimensions height="2.1" length="4.5" width="1.8"/> </BoundingBox> <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/> <Axles> <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/> <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/> </Axles> <Properties/> </Vehicle> </ScenarioObject> </Entities> <Storyboard> <Init> <Actions> <Private entityRef="Ego"> <PrivateAction> <TeleportAction> <Position> <LanePosition laneId="-4" offset="0" roadId="0" s="5"/> </Position> </TeleportAction> </PrivateAction> <PrivateAction> <LongitudinalAction> <SpeedAction> <SpeedActionDynamics dynamicsDimension="time" dynamicsShape="step" value="0"/> <SpeedActionTarget> <AbsoluteTargetSpeed value="16.66666667"/> </SpeedActionTarget> </SpeedAction> </LongitudinalAction> </PrivateAction> </Private> <Private entityRef="lead_vehicle"> <PrivateAction> <TeleportAction> <Position> <LanePosition laneId="-4" offset="0" roadId="0" s="38.33333333"/> </Position> </TeleportAction> </PrivateAction> <PrivateAction> <LongitudinalAction> <SpeedAction> <SpeedActionDynamics dynamicsDimension="time" dynamicsShape="step" value="0"/> <SpeedActionTarget> <AbsoluteTargetSpeed value="16.66666667"/> </SpeedActionTarget> </SpeedAction> </LongitudinalAction> </PrivateAction> </Private> <Private entityRef="target_blocking1"> <PrivateAction> <TeleportAction> <Position> <LanePosition laneId="-4" offset="0" roadId="0" s="500"/> </Position> </TeleportAction> </PrivateAction> </Private> <Private entityRef="target_blocking2"> <PrivateAction> <TeleportAction> <Position> <LanePosition laneId="-4" offset="0" roadId="0" s="515"/> </Position> </TeleportAction> </PrivateAction> </Private> </Actions> </Init> <Story name="CutOutMultipleBlockingTargetsStory"> <Act name="Ego_activate_controller_7_act"> <ManeuverGroup maximumExecutionCount="1" name="Ego_activate_controller_7_maneuvers"> <Actors selectTriggeringEntities="false"> <EntityRef entityRef="Ego"/> </Actors> <Maneuver name="Ego_activate_controller_7_maneuver"> <Event maximumExecutionCount="1" name="Ego_activate_controller_7_event" priority="overwrite"> <Action name="Ego_activate_controller_7"> <PrivateAction> <ActivateControllerAction lateral="true" longitudinal="true"/> </PrivateAction> </Action> <StartTrigger> <ConditionGroup> <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_7_condition_1"> <ByValueCondition> <SimulationTimeCondition rule="greaterThan" value="0"/> </ByValueCondition> </Condition> </ConditionGroup> </StartTrigger> </Event> </Maneuver> </ManeuverGroup> <StartTrigger> <ConditionGroup> <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_7_condition"> <ByValueCondition> <SimulationTimeCondition rule="greaterThan" value="10000"/> </ByValueCondition> </Condition> </ConditionGroup> </StartTrigger> </Act> <Act name="lead_vehicle_change_lane_1_act"> <ManeuverGroup maximumExecutionCount="1" name="lead_vehicle_change_lane_1_maneuvers"> <Actors selectTriggeringEntities="false"> <EntityRef entityRef="lead_vehicle"/> </Actors> <Maneuver name="lead_vehicle_change_lane_1_maneuver"> <Event maximumExecutionCount="1" name="lead_vehicle_change_lane_1_event" priority="overwrite"> <Action name="lead_vehicle_change_lane_1"> <PrivateAction> <LateralAction> <LaneChangeAction> <LaneChangeActionDynamics dynamicsDimension="rate" dynamicsShape="linear" value="2"/> <LaneChangeTarget> <RelativeTargetLane entityRef="lead_vehicle" value="1"/> </LaneChangeTarget> </LaneChangeAction> </LateralAction> </PrivateAction> </Action> <StartTrigger> <ConditionGroup> <Condition conditionEdge="rising" delay="0" name="lead_vehicle_change_lane_1_condition"> <ByEntityCondition> <TriggeringEntities triggeringEntitiesRule="any"> <EntityRef entityRef="lead_vehicle"/> </TriggeringEntities> <EntityCondition> <DistanceCondition alongRoute="true" freespace="true" rule="lessThan" value="50"> <Position> <RelativeObjectPosition dx="0" dy="0" dz="0" entityRef="target_blocking1"> <Orientation h="0" p="0" r="0" type="absolute"/> </RelativeObjectPosition> </Position> </DistanceCondition> </EntityCondition> </ByEntityCondition> </Condition> </ConditionGroup> </StartTrigger> </Event> </Maneuver> </ManeuverGroup> <StartTrigger> <ConditionGroup> <Condition conditionEdge="rising" delay="0" name="lead_vehicle_change_lane_1_condition_1"> <ByValueCondition> <SimulationTimeCondition rule="greaterThan" value="0"/> </ByValueCondition> </Condition> </ConditionGroup> </StartTrigger> </Act> </Story> <StopTrigger> <ConditionGroup> <Condition conditionEdge="rising" delay="0" name="story_end"> <ByValueCondition> <SimulationTimeCondition rule="greaterThan" value="40"/> </ByValueCondition> </Condition> </ConditionGroup> </StopTrigger> </Storyboard> </OpenSCENARIO>
ForwardDetectionRange
简述:主车Ego按照初始速度16.667mps匀速行驶,右前方(偏移5.25m)约500m处有一个行人target_blocking,10000s后激活Ego的controller,40s后停止场景(激活时间与场景停止时间可修改)。
osc2.0场景
import standard scenario ForwardDetectionRange: # map map: map map.set_map_file("./ALKS_Road.xodr") # parameter Ego_InitPosition_LaneId: string = "-4" Ego_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 5.0m, t: 0.0m) Ego_InitPosition: pose_3d with: keep(it.odr_point == Ego_Odr) Ego_InitSpeed_Ve0: speed = 16.66666667mps TargetBlocking_InitPosition_Offset: length = -5.25m TargetBlocking_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 500.0m, t: TargetBlocking_InitPosition_Offset) TargetBlocking_InitPosition: pose_3d with: keep(it.odr_point == TargetBlocking_Odr) m_vehicle_catalog: catalog = vehicle_catalog m_target_blocking_catalog: catalog = pedestrian_catalog Duration: time = 40s # entity Ego_Name: string = "Audi_A3_2009_black" Ego_Controller: string = "DefaultDriver" Ego: vehicle with: keep(it.name == Ego_Name) keep(it.initial_bm == Ego_Controller) target_blocking: person with: keep(it.name == "Christian") keep(it.model == "male_adult") # storyboard do parallel(duration: Duration): # init Ego.assign_init_position(position: Ego_InitPosition) Ego.assign_init_speed(Ego_InitSpeed_Ve0) target_blocking.assign_init_position(position: TargetBlocking_InitPosition) # story serial: # act 1: ActivateALKSControllerStory wait elapsed(10000s) Ego.activate_controller(true, true) # lateral, longitudinal
转化结果
<OpenSCENARIO> <FileHeader author="Octopus/Simulation" date="2022-10-29T01:46:19" description="" revMajor="1" revMinor="0"/> <CatalogLocations> <VehicleCatalog> <Directory path="Distros/Current/Config/Players/Vehicles"/> </VehicleCatalog> <ControllerCatalog> <Directory path="Distros/Current/Config/Players/driverCfg.xml"/> </ControllerCatalog> <PedestrianCatalog> <Directory path="Distros/Current/Config/Players/Pedestrians"/> </PedestrianCatalog> <MiscObjectCatalog> <Directory path="Distros/Current/Config/Players/Objects"/> </MiscObjectCatalog> </CatalogLocations> <RoadNetwork> <LogicFile filepath="./ALKS_Road.xodr"/> <SceneGraphFile filepath=""/> </RoadNetwork> <Entities> <ScenarioObject name="Ego"> <Vehicle name="Audi_A3_2009_black" vehicleCategory="car"> <BoundingBox> <Center x="1.5" y="0" z="0.9"/> <Dimensions height="2.1" length="4.5" width="1.8"/> </BoundingBox> <Performance maxAcceleration="8" maxDeceleration="8" maxSpeed="60"/> <Axles> <FrontAxle maxSteering="0.5" positionX="3.1" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/> <RearAxle maxSteering="0" positionX="0" positionZ="0.3" trackWidth="1.8" wheelDiameter="0.6"/> </Axles> <Properties> <Property name="control" value="external"/> </Properties> </Vehicle> <ObjectController> <Controller name="DefaultDriver"> <Properties/> </Controller> </ObjectController> </ScenarioObject> <ScenarioObject name="target_blocking"> <Pedestrian mass="80" model="male_adult" name="Christian" pedestrianCategory="pedestrian"> <BoundingBox> <Center x="1.5" y="0" z="0.9"/> <Dimensions height="2.1" length="4.5" width="1.8"/> </BoundingBox> <Properties/> </Pedestrian> </ScenarioObject> </Entities> <Storyboard> <Init> <Actions> <Private entityRef="Ego"> <PrivateAction> <TeleportAction> <Position> <LanePosition laneId="-4" offset="0" roadId="0" s="5"/> </Position> </TeleportAction> </PrivateAction> <PrivateAction> <LongitudinalAction> <SpeedAction> <SpeedActionDynamics dynamicsDimension="time" dynamicsShape="step" value="0"/> <SpeedActionTarget> <AbsoluteTargetSpeed value="16.66666667"/> </SpeedActionTarget> </SpeedAction> </LongitudinalAction> </PrivateAction> </Private> <Private entityRef="target_blocking"> <PrivateAction> <TeleportAction> <Position> <LanePosition laneId="-4" offset="-5.25" roadId="0" s="500"/> </Position> </TeleportAction> </PrivateAction> </Private> </Actions> </Init> <Story name="ForwardDetectionRangeStory"> <Act name="Ego_activate_controller_7_act"> <ManeuverGroup maximumExecutionCount="1" name="Ego_activate_controller_7_maneuvers"> <Actors selectTriggeringEntities="false"> <EntityRef entityRef="Ego"/> </Actors> <Maneuver name="Ego_activate_controller_7_maneuver"> <Event maximumExecutionCount="1" name="Ego_activate_controller_7_event" priority="overwrite"> <Action name="Ego_activate_controller_7"> <PrivateAction> <ActivateControllerAction lateral="true" longitudinal="true"/> </PrivateAction> </Action> <StartTrigger> <ConditionGroup> <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_7_condition_1"> <ByValueCondition> <SimulationTimeCondition rule="greaterThan" value="0"/> </ByValueCondition> </Condition> </ConditionGroup> </StartTrigger> </Event> </Maneuver> </ManeuverGroup> <StartTrigger> <ConditionGroup> <Condition conditionEdge="rising" delay="0" name="Ego_activate_controller_7_condition"> <ByValueCondition> <SimulationTimeCondition rule="greaterThan" value="10000"/> </ByValueCondition> </Condition> </ConditionGroup> </StartTrigger> </Act> </Story> <StopTrigger> <ConditionGroup> <Condition conditionEdge="rising" delay="0" name="story_end"> <ByValueCondition> <SimulationTimeCondition rule="greaterThan" value="40"/> </ByValueCondition> </Condition> </ConditionGroup> </StopTrigger> </Storyboard> </OpenSCENARIO>
逻辑场景(以CutOutMultipleBlockingTargets为例)
逻辑场景的ALKS样例,本文只介绍CutOutMultipleBlockingTargets,更多参数介绍,请查看官方文档。
osc2.0场景
import standard scenario CutOutMultipleBlockingTargets: # map map: map map.set_map_file("./ALKS_Road.xodr") # parameter Ego_InitPosition_LaneId: string = ['-4', '-1'] Ego_InitSpeed_Ve0: speed = [20mps, 40mps, 60mps, 80mps] LeadVehicle_InitDistance_dx0: length = [40m..80m] Ego_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 5.0m, t: 0.0m) Ego_InitPosition: pose_3d with: keep(it.odr_point == Ego_Odr) Blocking1_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 500.0m, t: 0.0m) Blocking1_InitPosition: pose_3d with: keep(it.odr_point == Blocking1_Odr) Blocking2_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: 515.0m, t: 0.0m) Blocking2_InitPosition: pose_3d with: keep(it.odr_point == Blocking2_Odr) LeadVehicle_Odr: odr_point = map.create_odr_point(road_id: '0', lane_id: Ego_InitPosition_LaneId, s: LeadVehicle_InitDistance_dx0, t: 0.0m) LeadVehicle_InitPosition: pose_3d with: keep(it.odr_point == LeadVehicle_Odr) FrontOfLead_Distance_dx0_f: length = 50.0m Lateral_Velocity_Vy: speed = [0.1mps..1.0mps] m_direction : distance_direction = longitudinal m_mode : distance_mode = bounding_boxes m_rate_profile: dynamics_shape = [step, linear] m_dimension: dynamics_dimension = rate m_side: lane_change_side = [left, right] Duration: time = [30s, 40s, 50s] # entity Ego_Name: string = ["Audi_A3_2009_black", "Audi_A3_2009_red"] LeadVehicle_Name: string = "Audi_A3_2009_red" TargetBlocking2_Name: string = "Audi_A3_2009_blue" Ego_Controller: string = "DefaultDriver" Ego: vehicle with: keep(it.name == Ego_Name) keep(it.initial_bm == Ego_Controller) target_blocking1: person with: keep(it.name == "Christian") keep(it.model == "male_adult") target_blocking2: vehicle with: keep(it.name == TargetBlocking2_Name) lead_vehicle: vehicle with: keep(it.name == LeadVehicle_Name) # storyboard do parallel(duration: Duration): # init Ego.assign_init_position(position: Ego_InitPosition) Ego.assign_init_speed(Ego_InitSpeed_Ve0) target_blocking1.assign_init_position(position: Blocking1_InitPosition) target_blocking2.assign_init_position(position: Blocking2_InitPosition) lead_vehicle.assign_init_position(position: LeadVehicle_InitPosition) lead_vehicle.assign_init_speed(Ego_InitSpeed_Ve0) serial: # act1: ActivateALKSControllerAct wait elapsed(10000s) Ego.activate_controller(true, true) # lateral, longitudinal serial: # act2: CutOutAct wait lead_vehicle.object_distance(reference: target_blocking1, direction: m_direction, mode: m_mode) < FrontOfLead_Distance_dx0_f lead_vehicle.change_lane(number_of_lanes: 1, side: m_side, reference: lead_vehicle, rate_peak: Lateral_Velocity_Vy, rate_profile: m_rate_profile, dimension: m_dimension)