OscControllerExample.xosc 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <OpenSCENARIO>
  3. <FileHeader revMajor="1" revMinor="0" date="2020-03-20T12:00:00" description="CARLA:ControllerExample" author=""/>
  4. <ParameterDeclarations/>
  5. <CatalogLocations/>
  6. <RoadNetwork>
  7. <LogicFile filepath="Town01"/>
  8. <SceneGraphFile filepath=""/>
  9. </RoadNetwork>
  10. <Entities>
  11. <ScenarioObject name="hero">
  12. <Vehicle name="vehicle.lincoln.mkz_2017" vehicleCategory="car">
  13. <ParameterDeclarations/>
  14. <Performance maxSpeed="69.444" maxAcceleration="200" maxDeceleration="10.0"/>
  15. <BoundingBox>
  16. <Center x="1.5" y="0.0" z="0.9"/>
  17. <Dimensions width="2.1" length="4.5" height="1.8"/>
  18. </BoundingBox>
  19. <Axles>
  20. <FrontAxle maxSteering="0.5" wheelDiameter="0.6" trackWidth="1.8" positionX="3.1" positionZ="0.3"/>
  21. <RearAxle maxSteering="0.0" wheelDiameter="0.6" trackWidth="1.8" positionX="0.0" positionZ="0.3"/>
  22. </Axles>
  23. <Properties>
  24. <Property name="type" value="ego_vehicle"/>
  25. <Property name="color" value="0,0,255"/>
  26. </Properties>
  27. </Vehicle>
  28. </ScenarioObject>
  29. <ScenarioObject name="adversary">
  30. <Vehicle name="vehicle.tesla.model3" vehicleCategory="car">
  31. <ParameterDeclarations/>
  32. <Performance maxSpeed="69.444" maxAcceleration="200" maxDeceleration="10.0"/>
  33. <BoundingBox>
  34. <Center x="1.5" y="0.0" z="0.9"/>
  35. <Dimensions width="2.1" length="4.5" height="1.8"/>
  36. </BoundingBox>
  37. <Axles>
  38. <FrontAxle maxSteering="0.5" wheelDiameter="0.6" trackWidth="1.8" positionX="3.1" positionZ="0.3"/>
  39. <RearAxle maxSteering="0.0" wheelDiameter="0.6" trackWidth="1.8" positionX="0.0" positionZ="0.3"/>
  40. </Axles>
  41. <Properties>
  42. <Property name="type" value="simulation"/>
  43. <Property name="color" value="255,0,0"/>
  44. </Properties>
  45. </Vehicle>
  46. </ScenarioObject>
  47. </Entities>
  48. <Storyboard>
  49. <Init>
  50. <Actions>
  51. <GlobalAction>
  52. <EnvironmentAction>
  53. <Environment name="Environment1">
  54. <TimeOfDay animation="false" dateTime="2020-03-20T12:00:00"/>
  55. <Weather cloudState="free">
  56. <Sun intensity="0.85" azimuth="0" elevation="1.31"/>
  57. <Fog visualRange="100000.0"/>
  58. <Precipitation precipitationType="dry" intensity="0.0"/>
  59. </Weather>
  60. <RoadCondition frictionScaleFactor="1.0"/>
  61. </Environment>
  62. </EnvironmentAction>
  63. </GlobalAction>
  64. <Private entityRef="hero">
  65. <PrivateAction>
  66. <TeleportAction>
  67. <Position>
  68. <LanePosition roadId="4" laneId="-1" offset="1.0" s="48.58"/>
  69. </Position>
  70. </TeleportAction>
  71. </PrivateAction>
  72. <PrivateAction>
  73. <ControllerAction>
  74. <AssignControllerAction>
  75. <Controller name="HeroAgent">
  76. <Properties>
  77. <Property name="module" value="external_control"/>
  78. </Properties>
  79. </Controller>
  80. </AssignControllerAction>
  81. <OverrideControllerValueAction>
  82. <Throttle value="0" active="false"/>
  83. <Brake value="0" active="false"/>
  84. <Clutch value="0" active="false"/>
  85. <ParkingBrake value="0" active="false"/>
  86. <SteeringWheel value="0" active="false"/>
  87. <Gear number="0" active="false"/>
  88. </OverrideControllerValueAction>
  89. </ControllerAction>
  90. </PrivateAction>
  91. </Private>
  92. <Private entityRef="adversary">
  93. <PrivateAction>
  94. <TeleportAction>
  95. <Position>
  96. <WorldPosition x="190" y="133" z="0" h="0"/>
  97. </Position>
  98. </TeleportAction>
  99. </PrivateAction>
  100. <PrivateAction>
  101. <ControllerAction>
  102. <AssignControllerAction>
  103. <Controller name="AdversaryAgent">
  104. <Properties>
  105. <Property name="module" value="npc_vehicle_control"/>
  106. <Property name="an_unused_property" value="an_unused_value"/>
  107. </Properties>
  108. </Controller>
  109. </AssignControllerAction>
  110. <OverrideControllerValueAction>
  111. <Throttle value="0" active="false"/>
  112. <Brake value="0" active="false"/>
  113. <Clutch value="0" active="false"/>
  114. <ParkingBrake value="0" active="false"/>
  115. <SteeringWheel value="0" active="false"/>
  116. <Gear number="0" active="false"/>
  117. </OverrideControllerValueAction>
  118. </ControllerAction>
  119. </PrivateAction>
  120. <PrivateAction>
  121. <LongitudinalAction>
  122. <SpeedAction>
  123. <SpeedActionDynamics dynamicsShape="step" value="20" dynamicsDimension="distance"/>
  124. <SpeedActionTarget>
  125. <AbsoluteTargetSpeed value="1"/>
  126. </SpeedActionTarget>
  127. </SpeedAction>
  128. </LongitudinalAction>
  129. </PrivateAction>
  130. </Private>
  131. </Actions>
  132. </Init>
  133. <Story name="MyStory">
  134. <Act name="Behavior">
  135. <ManeuverGroup name="ManeuverSequence" maximumExecutionCount="1">
  136. <Actors selectTriggeringEntities="false">
  137. <EntityRef entityRef="adversary"/>
  138. </Actors>
  139. <Maneuver name="FollowLeadingVehicleManeuver">
  140. <Event name="LeadingVehicleKeepsVelocity" priority="overwrite">
  141. <Action name="LeadingVehicleKeepsVelocity">
  142. <PrivateAction>
  143. <LongitudinalAction>
  144. <SpeedAction>
  145. <SpeedActionDynamics dynamicsShape="step" value="10000" dynamicsDimension="distance"/>
  146. <SpeedActionTarget>
  147. <AbsoluteTargetSpeed value="10"/>
  148. </SpeedActionTarget>
  149. </SpeedAction>
  150. </LongitudinalAction>
  151. </PrivateAction>
  152. </Action>
  153. <StartTrigger>
  154. <ConditionGroup>
  155. <Condition name="StartConditionLeadingVehicleKeepsVelocity" delay="0" conditionEdge="rising">
  156. <ByEntityCondition>
  157. <TriggeringEntities triggeringEntitiesRule="any">
  158. <EntityRef entityRef="hero"/>
  159. </TriggeringEntities>
  160. <EntityCondition>
  161. <RelativeDistanceCondition entityRef="adversary" relativeDistanceType="cartesianDistance" value="20.0" freespace="false" rule="lessThan"/>
  162. </EntityCondition>
  163. </ByEntityCondition>
  164. </Condition>
  165. </ConditionGroup>
  166. </StartTrigger>
  167. </Event>
  168. </Maneuver>
  169. </ManeuverGroup>
  170. <StartTrigger>
  171. <ConditionGroup>
  172. <Condition name="OverallStartCondition" delay="0" conditionEdge="rising">
  173. <ByEntityCondition>
  174. <TriggeringEntities triggeringEntitiesRule="any">
  175. <EntityRef entityRef="hero"/>
  176. </TriggeringEntities>
  177. <EntityCondition>
  178. <TraveledDistanceCondition value="1.0"/>
  179. </EntityCondition>
  180. </ByEntityCondition>
  181. </Condition>
  182. <Condition name="StartTime" delay="0" conditionEdge="rising">
  183. <ByValueCondition>
  184. <SimulationTimeCondition value="0" rule="equalTo"/>
  185. </ByValueCondition>
  186. </Condition>
  187. </ConditionGroup>
  188. </StartTrigger>
  189. <StopTrigger>
  190. <ConditionGroup>
  191. <Condition name="EndCondition" delay="0" conditionEdge="rising">
  192. <ByEntityCondition>
  193. <TriggeringEntities triggeringEntitiesRule="any">
  194. <EntityRef entityRef="hero"/>
  195. </TriggeringEntities>
  196. <EntityCondition>
  197. <TraveledDistanceCondition value="20000.0"/>
  198. </EntityCondition>
  199. </ByEntityCondition>
  200. </Condition>
  201. </ConditionGroup>
  202. </StopTrigger>
  203. </Act>
  204. </Story>
  205. <StopTrigger/>
  206. </Storyboard>
  207. </OpenSCENARIO>