更新时间:2024-05-13 GMT+08:00
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>
父主题: ALKS样例