Skip to main content
Skip table of contents

MORAI에서 정의한 OpenSCENARIO 요소

이 페이지에서는 다양한 시나리오의 구현을 위해 Scenario Runner에서 OpenSCENARIO에 추가하거나 수정한 요소를 정리한다. 각 항목은 해당 요소에 대한 정의 및 사용예시로 구성되어 있다.

목차


추가된 요소

Pedestrian Property

Pedestrian 이라는 Scenario Object 를 생성 할때, Property 의 값으로 Pedestrian 의 Animation 이 동작 조건을 정의한다. 동작 조건은 Ego 와의 거리와 Animation 이 동작 했을 때이며, 동작 이후의 거리를 정의한다.

Attribute

Type

Cardinality

Description

activeDistance

string

1..1

Ego 와 의 일정 거리에서, Pedestrian Animation 조정

moveDistance

string

1..1

Pedestrian Animation 의 동작 거리

CODE
<Properties>
    <Property name="activeDistance" value="20"/>
    <Property name="moveDistance" value="30"/>
</Properties>

MiscObject Property

[TEMP]

Attribute

Type

Cardinality

Description

moving_obstacle

string

1…1

TCR On / Off

CODE
<Properties>
    <Property name="moving_obstacle" value="true"/>
</Properties>

Evaluation

Triggers to stop a simulation and Returns a result of the simulation. (None, Success, Failure)

When there isn’t any condition group, it wouldn’t be triggered and returns None.

Element

Cardinality

Description

SuccessConditionGroup

0..*

At least one success condition group should be triggered to succeed the simulation.

FailureConditionGroup

0..*

All failure condition groups should not be triggered to succeed the simulation.

CODE
  <Evaluation>
    <SuccessConditionGroup>
      <Condition name="Ego_position" delay="0" conditionEdge="once">
        <ByEntityCondition>
          <TriggeringEntities triggeringEntitiesRule="any">
            <EntityRef entityRef="Ego" />
          </TriggeringEntities>
          <EntityCondition>
            <DistanceCondition value="5.0" freespace="false" rule="lessThan">
              <Position>
                <RelativeObjectPosition entityRef="Stop_Point" dx="0" dy="0" />
              </Position>
            </DistanceCondition>
          </EntityCondition>
        </ByEntityCondition>
      </Condition>
      <Condition name="Ego_position_limit" delay="0" conditionEdge="none">
        <ByEntityCondition>
          <TriggeringEntities triggeringEntitiesRule="any">
            <EntityRef entityRef="Ego" />
          </TriggeringEntities>
          <EntityCondition>
            <DistanceCondition value="500.0" freespace="false" rule="lessThan">
              <Position>
                <RelativeObjectPosition entityRef="Stop_Point" dx="0" dy="0" />
              </Position>
            </DistanceCondition>
          </EntityCondition>
        </ByEntityCondition>
      </Condition>
    </SuccessConditionGroup>
    <FailureConditionGroup>
      <Condition name="Collision_occured" delay="0" conditionEdge="once">
        <ByValueCondition>
          <UserDefinedValueCondition name="collision" rule="equalTo" value="true" />
        </ByValueCondition>
      </Condition>
    </FailureConditionGroup>
  </Evaluation>

 

LinkPosition

MORAI에서 사용하는 MGeo 데이터의 Link를 활용한 Position을 정의한다.

Attribute

Type

Cardinality

Description

id

string

1..1

link id

index

unsigned int

1..1

link 내 point index

CODE
<Route name="NPC_1_Route" closed="false" afterCompletion="hide">
    <Waypoint routeStrategy="shortest">
        <Position>
            <LinkPosition id="A219BS010381" index="2"/>
        </Position>
    </Waypoint>
    <Waypoint routeStrategy="shortest">
        <Position>
            <LinkPosition id="A219BS010402"/>
        </Position>
    </Waypoint>
    <Waypoint routeStrategy="shortest">
        <Position>
            <LinkPosition id="A219BS010422"/>
        </Position>
    </Waypoint>
    <Waypoint routeStrategy="shortest">
        <Position>
            <LinkPosition id="A219BS010073" index="10"/>
        </Position>
    </Waypoint>
</Route>

 

PositionInLinkCoordinates

RoutePosition에서 Link Position을 활용할 수 있도록 추가된 요소이다.

Attribute

Type

Cardinality

Description

id

string

1..1

link id

index

unsigned int

1..1

link 내 point index

CODE
<RoutePosition>
  <RouteRef />
  <Orienation />
  <InRoutePosition>
    <FromLinkCoordinates id=_3_0_L1_ index="2" />
  </InRoutePosition>
</RoutePosition>

Spline

Trajectory 의 Shape 은 다항식으로 표현되며, 다항식의 차수(degree) 결정해야 한다.

Attribute

Type

Cardinality

Description

degree

unsigned short

1..1

다항식의 차수(계수) [1차 ~5 차]

verticies

list

1..1

각 Vertex 의 List 정의

XML
<Trajectory closed="false" name="trajectory_name">
  <Shape>
    <Spline degree="2">
      <Vertex time="5">
        <Position>
          <LinkPosition id="48638" index="100"/>
        </Position>
      </Vertex>
      <Vertex time="5">
        <Position>
          <LinkPosition id="48650" index="66"/>
        </Position>
      </Vertex>
    </Spline>
  </Shape>
</Trajectory>

SimulationInfo

Simulator 관련 정보를 정의하기 위해 SimulatorInfo 요소를 정의한다.

Element

Cardinality

Description

ScenarioFile

1..1

로드할 MORAI SIM built-in 시나리오 파일 이름 정의

Map

1..1

로드할 MORAI SIM 맵 이름 정의

CODE
<SimulatorInfo>
  <ScenarioFile name="1.json" />
  <Map name="V_RHT_HighwayJunction_1" />
</SimulatorInfo>

 

PrivateAction

ParkingAction

Attribute

Type

Cardinality

Description

name

string

1..1

ID of the parking space in MGeo.

type

enum

1..1

Parking methods ('parallel’, ‘rear’, ‘front’)

action

enum

1..1

‘park’: to park at the parking space
'exit': to exit from the parking space

CODE
<Action name="Parking_Action">
  <PrivateAction>
    <ParkingAction name="P002079" type="parallel" action="park" />
  </PrivateAction>
</Action>

 

GlobalAction

PedestrianSourceAction

Spawns pedestrian objects.

Attribute

Type

Cardinality

Description

radius

double

1..1

Radius of spawn area (not implemented)

count

integer

0..1

Maximum spawn pedestrians (default: 1e6)

period

double

0..1

Period on which pedestrians appear at the source location (sec). (default: 1 sec)

mode

enum

1..1

Defines behavior of a spawned pedestrian.
(once/ closedLoop/ repeat/ loop/ newPath/ stand)

pedestrianType

string

 

0..1

Defines type(model) of a spawned pedestrian.
(random (default) / man(1-8)_ai / woman(4-8)_ai)

Element

Cardinality

Description

Position

1..1

Position of the spawn area

Waypoint

0..1

Target location of spawned pedestrians

CODE
<GlobalAction>
  <TrafficAction>
    <PedestrianSourceAction radius="10" count="5" period="10"
                            mode="closedLoop" pedestrianType="random" >
      <Position>
        <WorldPosition x="307.426506536839" y=" 118.975891092156" z="0.15"/>
      </Position>
      <Waypoint routeStrategy="random">
        <Position>
          <WorldPosition x="314.494013321081" y="191.865" z="0.15" h="0.0" p="0.0" r="0.0"/>
        </Position>
      </Waypoint>
    </PedestrianSourceAction>
  </TrafficAction>
</GlobalAction>

UserDefinedAction

CreateMapObjectAction

CreatePuddleAction

Creates a puddle at the given position. The puddle area has scaled friction.

Attribute

Type

Cardinality

Description

name

string

1..1

ID of a puddle

positionX

double

1..1

The x coordinate value. (unit: m)

positionY

double

1..1

The y coordinate value. (unit: m)

positionZ

double

1..1

The z coordinate value. (unit: m)

rotationX

double

1..1

The roll angle of the object, defining a mathematically positive rotation about the x-axis (unit: deg)

rotationY

double

1..1

The pitch angle of the object, defining a mathematically positive rotation about the y-axis (unit: deg)

rotationZ

double

1..1

The yaw angle of the object, defining a mathematically positive rotation about the z-axis (unit: deg)

radiusH

double

1..1

Horizontal radius of the puddle (unit: m)

radiusV

double

1..1

Vertical radius of the puddle (unit: m)

height

double

1..1

Height of the puddle (unit: m)

friction

double

1..1

Multiplier of the friction on the puddle (range: [0..1])

CODE
<Init>
  <UserDefinedAction>
    <CreateMapObjectAction>
      <CreatePuddleAction name="Puddle_1" positionX="20.2" positionY="17.6" positionZ="0.19"
                                          rotationX="0.0" rotationY="0.0" rotationZ="90.0"
                                          radiusH="1.5" radiusV="2.0" height="0.01" friction="0.1" />
    </CreateMapObjectAction>
  </UserDefinedAction>
</Init>

 

ActivateMapObjectAction

Activate or deactivate Map Object in simulation.

Attribute

Type

Cardinality

Description

name

string

1..1

ID of the map object to be activated or deactivated.

activation

boolean

1..1

true: Activate map object.
false: Deactivate map object.

CODE
<Init>
  <UserDefinedAction>
    <ActivateMapObjectAction name="Puddle_1" activation="false" />
  </UserDefinedAction>
</Init>

 

FaultInjectionAction

Attribute

Type

Cardinality

Description

entityRef

string

1..1

ID of entity to inject fault

DamageAction

Injects a type-wise damage to the actors. The corresponding state would be maintained as it was when the action was activated.

Attribute

Type

Cardinality

Description

type

enum

1..1

Damage type (currently, ‘fire’ is the only option)

CODE
<Action name="Fire_Action">
  <UserDefinedAction>
    <FaultInjectionAction entityRef="Ego">
      <DamageAction type="fire" />
    </FaultInjectionAction>
  </UserDefinedAction>
</Action>

 

InoperabilityAction

Injects a type-wise Inoperability to the actors. The corresponding state would be maintained as it was when the action was activated.

Attribute

Type

Cardinality

Description

type

enum

1..1

Fault type (accel, brake, steer)

CODE
<Action name="Steering_Fault_Action">
  <UserDefinedAction>
    <FaultInjectionAction entityRef="Ego">
      <InoperabilityAction type="steer" />
    </FaultInjectionAction>
  </UserDefinedAction>
</Action>

 

SensorFaultAction

Injects an sensor fault to a sensor. The sensor would be shifted by the given offsets.

Attribute

Type

Cardinality

Description

name

string

1..1

ID of a sensor in MGeo

active

boolean

1..0

true: publish sensor data

false: stop publishing sensor data

offsetX

double

1..0

Artificial translation offset of the sensor in X coordinate

offsetY

double

1..0

Artificial translation offset of the sensor in Y coordinate

offsetZ

double

1..0

Artificial translation offset of the sensor in Z coordinate

offsetP

double

1..0

Artificial rotation offset of the sensor about the X axis

offsetQ

double

1..0

Artificial rotation offset of the sensor about the Y axis

offsetR

double

1..0

Artificial rotation offset of the sensor about the Z axis

CODE
<Action name="Sensor_Fault_Action">
  <UserDefinedAction>
    <FaultInjectionAction entityRef="Ego">
      <SensorFaultAction name="3" active="true" offsetX="1" offsetY="1" offsetZ="1" 
                                  offsetP="1" offsetQ="1" offsetR="1" />
    </FaultInjectionAction>
  </UserDefinedAction>
</Action>

 

SteeringDisturbanceAction

Injects a steering disturbance to actors.

Attribute

Type

Cardinality

Description

duration

double

1..1

Duration of the fault. (unit: sec , range: [0..inf])

magnitude

double

1..1

Magnitude of the fault. (range: [-1..1])

CODE
<Action name="Steering_Disturbance_Action">
  <UserDefinedAction>
    <FaultInjectionAction entityRef="Ego">
      <SteeringDisturbanceAction duration="12.5" magnitude="0.8" />
    </FaultInjectionAction>
  </UserDefinedAction>
</Action>

 

TireFaultAction

Injects a tire fault to actors.

Attribute

Type

Cardinality

Description

tireIndex

enum

1..1

Index of a tire of the actors ( 0, 1, 2, 3, … )

CODE
<Action name="Tire_Fault_Action">
  <UserDefinedAction>
    <FaultInjectionAction entityRef="Ego">
      <TireFaultAction tireIndex="3" />
    </FaultInjectionAction>
  </UserDefinedAction>
</Action>

 

수정된 요소

Route

afterCompletion 속성을 추가로 정의하여 경로 주행 후 동작을 정의한다.

Attribute

Type

Cardinality

Description

name

string

1..1

Name of the route.

closed

boolean

1..1

In a closed route, the last waypoint is followed by the first waypoint to create a closed route.

afterCompletion

enum

1..1

Behavior after arriving at the target waypoint
( ‘hide’: remove the vehicle (default),
‘stop’: stop, ‘random’: drive along a random route)

Element

Cardinality

Description

ParameterDeclarations

0..*

Definition of additional parameters.

Waypoints

2..*

At least two waypoints are needed to define a route.

CODE
<Route name="NPC_1_Route" closed="false" afterCompletion="hide">
    <Waypoint routeStrategy="shortest">
        <Position>
            <LinkPosition id="A219BS010381" index="2"/>
        </Position>
    </Waypoint>
    <Waypoint routeStrategy="shortest">
        <Position>
            <LinkPosition id="A219BS010402"/>
        </Position>
    </Waypoint>
    <Waypoint routeStrategy="shortest">
        <Position>
            <LinkPosition id="A219BS010422"/>
        </Position>
    </Waypoint>
    <Waypoint routeStrategy="shortest">
        <Position>
            <LinkPosition id="A219BS010073" index="10"/>
        </Position>
    </Waypoint>
</Route>

 

SpeedActionTarget

AbsoluteTargetSpeed

MGeo 상에 정의된 Link Speed 및 속도의 오차범위를 추가로 정의한다.

Attribute

Type

Cardinality

Description

value

double

1..1

Value of the absolute speed.
( link_type: [0..1], custom_type: [0..inf] (m/s))

type (added)

enum

0..1

Type of the defined speed. ( ‘link’, ‘custom’ )

range (added)

double

0..1

Range of the speed
( link_type: [0..1], custom_type: [0..inf] (m/s))

CODE
<AbsoluteTargetSpeed type="link" value="0.05" />
<AbsoluteTargetSpeed type="custom" value="-15" range="5" />
<AbsoluteTargetSpeed type="link" value="0.9" range="0.05" />

 

RelativeTargetSpeed

MGeo 상에 정의된 Link Speed 및 상대속도의 오차범위를 추가로 정의한다.

Attribute

Type

Cardinality

Description

continuous

boolean

1..1

True: a controller tries to maintain a continuous relative speed (not implemented)

entityRef

string

1..1

Reference entity

speedTargetValueType

enum

1..1

The value is either a delta or a factor.

value

double

1..1

Value of the relative speed. This value is either given as a delta or as a factor.
( link_type: [0..1], custom_type: [0..inf] (m/s))

type (added)

enum

0..1

Type of the defined speed. ( ‘link’, ‘custom’ )

range (added)

double

0..1

Range of the speed
( link_type: [0..1], custom_type: [0..inf] (m/s))

CODE
<RelativeTargetSpeed continuous="false" entityRef="Ego" speedTaretValueType="delta"
                     type="link" value="0.05" />
<RelativeTargetSpeed continuous="false" entityRef="Ego" speedTaretValueType="delta"
                     type="custom" value="-15" range="5" />
<RelativeTargetSpeed continuous="false" entityRef="Ego" speedTaretValueType="factor"
                     type="custom" value="1.1" range="0.05" />
<RelativeTargetSpeed continuous="true" entityRef="Ego" speedTaretValueType="factor"
                     type="link" value="0.9" range="0.05" />

 

TrafficDefinition

OpenScenario 에서와는 달리 각 Vehicle Distribution 마다 Controller를 지정하지 않아도 된다.

Attribute

Type

Cardinality

Description

name

string

1..1

Name of the traffic definition.

Element

Cardinality

Description

VehicleCategoryDistribution

1..1

Distribution of vehicle categories within the traffic.

ControllerDistribution

0..1

Distribution of controllers within this traffic.

CODE
<TrafficDefinition name="TrafficDefinition_1">
  <VehicleCategoryDistribution>
    <VehicleCategoryDistributionEntry model="2016_Hyundai_Ioniq" weight="1" />
  </VehicleCategoryDistribution>
</TrafficDefinition>

 

VehicleCategoryDistributionEntry

차량의 카테고리 또는 특정 모델을 지정하여 정의할 수 있다.

Attribute

Type

Cardinality

Description

model (added)

string

0..1

Model name of the vehicle which is implemented in MORAI SIM: Drive. If it’s specified, ‘category’ would be ignored. Either ‘model’ or ‘category’ is required.

category (modified)

enum

0..1

The category of the vehicles that appear in traffic.
(bicycle/ bus/ car/ motorbike/ semitrailer/ trailer/ train/ tram/ truck/ van/ mini/ compact/ middle/ large)

weight

double

1..1

The weight of a vehicle category within a traffic distribution. [0..inf]

CODE
<TrafficDefinition name="TrafficDefinition_1">
  <VehicleCategoryDistribution>
    <VehicleCategoryDistributionEntry model="2016_Hyundai_Ioniq" weight="1" />
  </VehicleCategoryDistribution>
</TrafficDefinition>

<TrafficDefinition name="TrafficDefinition_2">
  <VehicleCategoryDistribution>
    <VehicleCategoryDistributionEntry category="compact" weight="1" />
    <VehicleCategoryDistributionEntry category="middle" weight="1" />
    <VehicleCategoryDistributionEntry category="large" weight="1" />
  </VehicleCategoryDistribution>
</TrafficDefinition>

<TrafficDefinition name="TrafficDefinition_3">
  <VehicleCategoryDistribution>
    <VehicleCategoryDistributionEntry model="2016_Hyundai_Ioniq" weight="1" />
    <VehicleCategoryDistributionEntry category="mini" weight="1" />  <!-- would be ignored -->
  </VehicleCategoryDistribution>
</TrafficDefinition>

 

GlobalAction

TrafficSignalControllerAction

교차로 신호 Phase를 변경한다. Phase 요소를 하위에 정의하여 교차로 신호 Phase 정의 자체를 변경할 수도 있고, Phase 요소 없이 phase 속성만 정의하여 현재 신호만 변경할 수도 있다.

Attribute

Type

Cardinality

Description

trafficSignalControllerRef
(modified)

string

1..1

ID of the intersection controller in MGeo.

phase (modified)

unsigned int

1..1

The phase of the signal controller would be changed to the given value (0, 1, 2, …)

PhaseRef (deleted)

string

0..0

reference to pre-defined Phase

Element

Cardinality

Description

Phase (moved)

0..1

(According to OpenSCENARIO, It should be defined under RoadNetwork. Now it is directly defined under the action.)

CODE
<GlobalAction>
  <InfrastructureAction>
    <TrafficSignalAction>
      <TrafficSignalControllerAction trafficSignalControllerRef="IntTL1" phase="1" />
      <!-- The phase of "IntTL1" would be changed to phase "1" -->
    </TrafficSignalAction>
  </InfrastructureAction>
</GlobalAction>
CODE
<GlobalAction>
  <InfrastructureAction>
    <TrafficSignalAction>
      <TrafficSignalControllerAction trafficSignalControllerRef="IntTL1" phase="1">
        <Phase name="phase1" duration="5">
          <TrafficSignalState trafficSignalId="C119BS010034" state="G_with_GLeft"/>
          <TrafficSignalState trafficSignalId="C119BS010072" state="R"/>
          <TrafficSignalState trafficSignalId="C119BS010033" state="R"/>
        </Phase>
        <Phase name="phase2" duration="5">
          <TrafficSignalState trafficSignalId="C119BS010034" state="R"/>
          <TrafficSignalState trafficSignalId="C119BS010072" state="G_with_GLeft"/>
          <TrafficSignalState trafficSignalId="C119BS010033" state="R"/>
        </Phase>
        <Phase name="phase3" duration="5">
          <TrafficSignalState trafficSignalId="C119BS010034" state="R"/>
          <TrafficSignalState trafficSignalId="C119BS010072" state="R"/>
          <TrafficSignalState trafficSignalId="C119BS010033" state="G_with_GLeft"/>
        </Phase>
      </TrafficSignalControllerAction>
    </TrafficSignalAction>
  </InfrastructureAction>
</GlobalAction>

 

TrafficSignalStateAction

Attribute

Type

Cardinality

Description

name (modified)

string

1..1

ID of the signal in MGeo.

state (modified)

enum

1..1

Targeted state of the signal. The available states are listed in TrafficSignal list of _TRAFFICLIGHT_LIGHTCOLOR

impulse (added)

boolean

1..1

true: return to the phase cycle,
false: keep the given signal state

setSibling (added)

boolean

1..1

true: change all synced signals,
false: change this signal only

CODE
<GlobalAction>
  <InfrastructureAction>
    <TrafficSignalAction>
      <TrafficSignalStateAction name="C119BS010034" state="SG" impulse="false" setSibling="false"/>
    </TrafficSignalAction>
  </InfrastructureAction>
</GlobalAction>

 

TrafficSourceAction

Spawns vehicle objects. Several attributes are added for the compatibility with MORAI SIM: Drive

Attribute

Type

Cardinality

Description

radius

double

1..1

Radius of spawn area (not implemented)

velocity

double

0..1

Initial velocity of spawned vehicles (m/s). It would be ignored when ‘InitSpeed’ is defiend.

count

integer

0..1

Maximum spawn vehicles (default: 1e6)

rate

double

0..1 *

Rate on which vehicles appear at the source location (vehicles/s). It would be ignored when ‘Period’ is defined

period

double

0..1 *

Period on which vehicles appear at the source location (sec). Either ‘rate’ or ‘period’ is required.

periodRange

double

0..1

Range of the period (sec)

offset

double

0..1

Signed number the vehicle should respect as an offset from the center of the current lane. [-1..1]

offsetRange

double

0..1

Range of the offset [0..1]

closedLoop

bool

0..1

True: spawned vehicles would come back to the spawn location. False: vehicles would be disappear at their target location.

discretionaryLaneChange

bool

0..1

True: a spawned vehicle would change its lane randomly. False: the vehicle would keep its initial lane.

Element

Cardinality

Description

Position

1..1

Position of the spawn area

InitSpeed

1..1

Initial speed of spawned vehicles

DesiredSpeed

0..1

Desired speed of spawned vehicles

Waypoint

0..1

Target location of spawned vehicles

TrafficDefinition

1..1

Defines the vehicle and controller distribution for the source.

CODE
<GlobalAction>
  <TrafficAction>
    <TrafficSourceAction radius="10" count="5" period="10" periodRange="5" 
                         offset="0" offsetRange="0.1"
                         closedLoop="false" discretionaryLaneChange="true" >
      <Position>
        <LinkPosition id="A219BS010313" index="0"/>
      </Position>
      <InitSpeed>
        <AbsoluteTargetSpeed type="link" value="0.35" range="0.05"/>
      </InitSpeed>
      <DesiredSpeed>
        <AbsoluteTargetSpeed type="custom" value="55" range="15"/>
      </DesiredSpeed>
      <Waypoint routeStrategy="random">
        <Position>
          <LinkPosition id="A219BS010319" index="280"/>
        </Position>
      </Waypoint>
      <TrafficDefinition name="TrafficDefinition_1">
        <VehicleCategoryDistribution>
          <VehicleCategoryDistributionEntry model="2014_Kia_K7" weight="1" />
        </VehicleCategoryDistribution>
      </TrafficDefinition>
    </TrafficSourceAction>
  </TrafficAction>
</GlobalAction>

 


© 2022 MORAI Inc.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.