Disclaimer

This document is the copyrighted property of ASAM e.V.

Any use is limited to the scope described in the license terms (https://www.asam.net/license). In alteration to the regular license terms, ASAM allows unrestricted distribution of this standard. ยง2 (1) of ASAM’s regular license terms is therefore substituted by the following clause: "The licensor grants everyone a basic, non-exclusive and unlimited license to use the standard ASAM OpenSCENARIO".

Foreword

ASAM e. V. (Association for Standardization of Automation and Measuring Systems) is a non-profit organization that promotes standardization of tool chains in automotive development and testing. Our members are international car manufacturers, suppliers, tool vendors, engineering service providers and research institutes. ASAM standards are developed by experts from our member companies and are thus based on real use cases. They enable the easy exchange of data or tools within a tool chain. ASAM is the legal owner of these standards and responsible for their distribution and marketing.

ASAM standards define file formats, data models, protocols and interfaces for tools that are used for the development, test and validation of electronic control units (ECUs) and of the entire vehicle. The standards enable easy exchange of data and tools within a tool chain. They are applied worldwide.

Introduction

Overview

ASAM OpenSCENARIO comprises the specification and file schema for the description of dynamic content in driving simulation applications. The primary use of ASAM OpenSCENARIO is the description of complex maneuvers that involve multiple vehicles.

ASAM OpenSCENARIO is used in virtual development, test, and validation of functions for driver assistance, automated driving and autonomous driving. The standard may be used in conjunction with ASAM OpenDRIVE [1] and ASAM OpenCRG [2], which describe static content in driving simulation.

Scenario descriptions are essential for testing, validating, and certifying the safety of driver assistance systems and autonomous cars. The industry, certification bodies, and government authorities jointly define scenario libraries that can be used to test and validate the safe operation of such systems. A publicly developed and vendor-independent standard, such as ASAM OpenSCENARIO, supports this endeavor by enabling the exchange and usability of scenarios in various simulation applications.

As an example, with the help of ASAM OpenSCENARIO large numbers of critical situations can be run across various simulators. Thus, compared to road testing in real traffic, the number of test kilometers driven in field tests can be significantly reduced.

overview open x
Figure 1. Relationship between ASAM OpenSCENARIO, ASAM OpenDRIVE, and ASAM OpenCRG

What is a scenario?

A scenario is a description of how the view of the world changes with time, usually from a specific perspective. In the context of vehicles and driving, this encompasses the developing view of both world-fixed (static) elements, such as road layout and road furniture, and world-changing (dynamic) elements, such as weather and lighting, vehicles, objects, people, and traffic light states. This description is independent of whether the environment is simulated, real, or any combination thereof.

In a simulation context, a complete scenario is comprised of the following parts:

  • Static environment description, including:

    • Logical road network

    • Optionally physical and geometric road and environment descriptions

  • Dynamic content description, including:

    • Overall description and coordination of behavior of dynamic entities

    • Optional behavior models of dynamic entities

What is ASAM OpenSCENARIO?

ASAM OpenSCENARIO defines a data model and a derived file format for the description of scenarios used in driving and traffic simulators, as well as in automotive virtual development, testing, and validation. The primary use case of ASAM OpenSCENARIO is to describe complex, synchronized maneuvers that involve multiple entities, like vehicles, pedestrians, and other traffic participants. The description of a scenario may be based on driver actions, for example, performing a lane change, or on trajectories, for example, derived from a recorded driving maneuver. The standard provides the description methodology for scenarios by defining hierarchical elements, from which scenarios, their attributes, and relations are constructed. This methodology comprises:

  • Storyboarding, that is usage of a storyboard and stories. Each story consists of one or more acts and maneuvers.

  • An event is triggered by a trigger, when a condition is evaluated to true. Events cause the execution of actions.

  • References to logical road network descriptions.

  • Instantiation of entities, such as vehicles, or pedestrians, acting on and off the road.

  • Catalogs and parameter declarations provide mechanisms to re-use several aspects of a scenario.

Other content, such as the description of the ego vehicle, entity appearance, pedestrians, traffic and environment conditions, is included in the standard as well.

Scenario descriptions in ASAM OpenSCENARIO are organized in a hierarchical structure and serialized in an XML file format with the file extension .xosc.

ASAM OpenSCENARIO defines the dynamic content of the (simulated) world, for example, the behavior of traffic participants. Static components, such as the road network, are not part of ASAM OpenSCENARIO but can be referenced by the format.

ASAM OpenSCENARIO does not specify the behavior models themselves or their handling by a simulation engine.

Furthermore, beyond the scenario itself, other pieces of information are needed to describe a full simulation setup and test case. ASAM OpenSCENARIO cannot be regarded as a complete specification of a simulator, its system under test or, its test case. The following features specifically are not considered in scope for ASAM OpenSCENARIO:

Table 1. What is not part of ASAM OpenSCENARIO
Feature Description

Test configuration description

ASAM OpenSCENARIO does not describe a test instance or its structure.

Test case language

ASAM OpenSCENARIO does not specify all possible user or system interactions with a vehicle.

Test evaluation

ASAM OpenSCENARIO does not include concepts for creating test verdicts, although it contains methods for the evaluation conditions for triggering actions.

Driver model

ASAM OpenSCENARIO does not include behavioral driver models, except for basic concepts, such as the physiological description of a driver.

Vehicle dynamics

ASAM OpenSCENARIO does not include elements to describe advanced motion dynamics for vehicles.

Environmental models

ASAM OpenSCENARIO includes elements to define environmental properties, such as the current time or the weather, but does not specify how this is to be interpreted by a simulator.

Conventions and notations

Normative and non-normative statements

This User Guide uses a standard information structure. The following rules apply regarding normativity of sections:

  • Statements expressed as requirements, permissions, or prohibitions according to the use of modal verbs, as defined in Modal verbs, are normative.

  • Code samples and use case descriptions are non-normative.

Naming conventions

Elements in scenario descriptions may be referenced from other parts of the description through their names. To ensure that all references can be unambiguously resolved, the following set of rules apply for references to scenario elements:

  • Name lookup shall start at the referencing element, but shall comprise all elements at all hierarchy levels of the scenario hierarchy.

  • Element names at each level shall be unique at that level. There shall not be more than one element with the same name at the same level (within the same directly enclosing element). For example, within one Story, every Act shall use a unique name ("MyStory1": "MyAct1", "MyAct2"…​), but the names of the acts may be reused in another story ("MyStory2": "MyAct1", "MyAct2"…​).

  • If the referenced name is globally unique, then it may be used directly as the only part of the reference. If the referenced name is not globally unique, name prefixes shall be used to make the name unique.

  • A name prefix consists of the name of a directly enclosing element, which is prefixed to the name using the separator '::', thus forming a new name reference. This implies that the '::' must not be used in names itself. The name is disambiguated by the "::" specifying a directly enclosing element name.

  • Multiple prefixes of subordinate enclosing elements may be specified, up to the root element name, until a globally unique reference name is established.

  • If a reference cannot be resolved uniquely, for example, if too few name prefixes have been specified the result of the lookup is undefined.

Units

All numeric values within this standard are using SI units, unless explicitly stated otherwise. Table 2 presents details of the used units.

Table 2. Units
Unit of Name Symbol

Length

Meter

m

Duration, (relative) time

Second

s

Speed

Meters per second

m/s

Acceleration

Meters per second squared

m/sยฒ

Jerk

Meters per second cubed

m/sยณ

Force

Newton

N

Torque

Newton meter

Nm

Mass

Kilogram

kg

Angle

Radians

rad

Angle (geo referencing)

Degree

ยฐ

Illuminance

Lux

lx

Luminous intensity

Candela

cd

Temperature

Kelvin

K

Pressure

Pascal

Pa

Data types

ASAM OpenSCENARIO uses the XSD 1.0 data types [3] string, Boolean, dateTime, double, int, unsignedInt and unsignedShort.

In ASAM OpenSCENARIO, the usage of date and time is restricted to the ISO 8601 [4] Basic Notation. The following format pattern is used: "yyyy-MM-dd 'T' HH:mm:ss '.' FFFZ". Here 'T' is again used as time designator and '.' is used as separator for the following millisecond portion. An explanation is given in Table 3.

Table 3. Date and time format specifiers
Specifiers Meaning Example

yyyy

Year (four digits)

2011

M, MM

Month in year (without / with leading zero)

9, 09

d, dd

Day in month (without / with leading zero)

3, 09

H, HH

Hours, 0-23 count (without / with leading zero)

7, 07

m, mm

Minutes (without / with leading zero)

2, 02

s, ss

Seconds (without / with leading zero)

4, 04

F, FF, FFF

Milliseconds (without / with leading zeros)

357, 04, 002

Z

RFC 822 time zone (time shift to GMT)

+100

At a given date and time of 2011-03-10 11:23:56 in the Central European Time zone (CET), the following standard-format output is produced:

2011-03-10T11:23:56.000+0100

Modal verbs

To ensure compliance with the other OpenX standards, users must be able to distinguish between mandatory requirements, recommendations, permissions, as well as possibilities, capabilities, obligations, and necessities.

The following rules for using modal verbs apply:

Table 4. Rules for using modal verbs
Provision Verbal form

Requirement
Requirements shall be followed strictly in order to be conform to the standard. Deviations are not allowed.

shall
shall not

Recommendation
Recommendations indicate that among several possibilities, one is recommended as particularly suitable, without mentioning or excluding others.

should
should not

Permission
Permissions indicate a course of action permissible within the limits of the ASAM standard’s deliverables.

may
need not

Possibility and capability
These verbal forms are used for stating possibilities or capabilities, being technical, material, physical, or others.

can
cannot

Obligation and necessity
These verbal forms are used to describe legal, organizational, or technical obligations and necessities that are not regulated or enforced by the ASAM standard’s.

must
must not

Typographic conventions

This documentation uses the following typographical conventions:

Table 5. Typographical conventions
Mark-up Definition

Code elements

This format is used for code elements, such as technical names of classes and attributes, as well as attribute values, and language elements.

Terms

This format is used to introduce glossary terms, new terms and to emphasize terms.

Deliverables

The core of the specification is an XML schema file. It is accompanied by an HTML documentation of its underlying UML model and by this User Guide. Several example files show, how the XML schema has to be applied to model scenarios. To migrate existing scenario files to newer versions, scripts and schemas are provided. The UML model and modeling guidelines for further extensions are provided as well.

Thus, the standard comprises the following content:

  • User Guide, this document

  • XML schema file

  • UML model

  • UML Model reference documentation (HTML)

  • Examples

  • Migration scripts and schemas

  • Modeling guidelines

Revision history

Table 6. Revision history of ASAM OpenSCENARIO
Version number Release date Comments

v1.1.1

2021-11-10

Bugfix Release

v1.1.0

2021-03-18

v1.0.0

2020-03-13

Transfer to ASAM

v0.9.1

2018-09-01

Changelog

The following main changes were made in ASAM OpenSCENARIO v1.2 compared to ASAM OpenSCENARIO v1.1:

  • Support for virtual sensor recognition testingโ€‹

    • Reference to sky & illumination imageโ€‹

    • More options for custom propertiesโ€‹

  • Support for sensor error injectionโ€‹

    • False positive / false negative for entitiesโ€‹

  • Introduction of variablesโ€‹

    • Separated concept from parametersโ€‹

    • Can change during runtime

    • External accessโ€‹

  • Support for multiple controllersโ€‹

    • Lateral and/or longitudinalโ€‹

    • Two new controller types (animation / light)โ€‹

  • Improvement in controller overridesโ€‹

    • Physical valuesโ€‹

    • Dynamic limitations (max rate, max torque)โ€‹

  • New entity roleโ€‹ attribute

    • Police, ambulance…​โ€‹

  • New Light actionโ€‹

    • Vehicle lightsโ€‹

  • New Animation actionโ€‹

    • Vehicle components (doors, windows, mirrors)

    • Pedestrian motionsโ€‹ & gestures

    • Reference to 3d animation filesโ€‹

  • New Speed profile actionโ€‹

    • For modelling of realistic speed profilesโ€‹

  • Extended Traffic Swarm actionโ€‹

    • Velocity rangeโ€‹

    • Direction of travelโ€‹

  • Extended Speed & acceleration conditionโ€‹

    • Check per dimension (lateral, longitudinal, both)โ€‹

  • New Clearance conditionโ€‹

  • Clarificationsโ€‹

    • Coordinate systems & rotationsโ€‹

    • Position types (esp. Road/Lane)โ€‹

    • Relative and absolute orientation in positions + defaultsโ€‹

    • Speed (longitudinal/lateral domain)โ€‹

    • Distance calculations across several roadsโ€‹

    • Route calculationโ€‹

    • Route assignmentโ€‹

    • Closed trajectoryโ€‹

    • Interfacing between scenario and test case / runtime environmentโ€‹

    • Dynamic constraints of entities in actionsโ€‹

    • Action prerequisitesโ€‹

    • Add / remove entity actionsโ€‹

  • Fixesโ€‹

    • Datatype integer → intโ€‹

    • Gear number: double → int for manual and enum for automatic gear

    • Overwrite → overrideโ€‹

    • State machine states (standby vs. complete)โ€‹

    • GeoPosition in degreeโ€‹

  • Harmonizationโ€‹

    • Cloud state (ASAM OSI)โ€‹

    • Traffic signal controller (ASAM OpenDRIVE)โ€‹

Complementary standards and formats

ASAM OpenSCENARIO can be complemented by other logical road network and 3D model formats. The following list gives some examples:

  • Logical road network

    • Navigation Data Standard (NDS) [5]

  • 3D models of road, scenery and objects

    • CityGML [6]

    • OpenSceneGraph [7]

    • glTF (Khronos Group) [8]

    • FBX (Autodesk) [9]

    • 3ds (Autodesk) [10]

1. Scope

ASAM OpenSCENARIO specifies the modeling approach how to describe dynamic content in driving application simulations using the Extensible Markup Language (XML).

The ASAM OpenSCENARIO standard

  • specifies the schema for ASAM OpenSCENARIO in an UML model and an XSD schema. The UML model and the XSD schema defines the structure, sequence, elements, and values of ASAM OpenSCENARIO. The XSD schema is derived from the UML model.

  • provides the XSD schema to which valid ASAM OpenSCENARIO files shall conform.

  • explains how the ASAM OpenSCENARIO elements are used and relationships between elements in the ASAM OpenSCENARIO UML model and XSD schemas, for example, actions, entities, a road network, and triggers.

2. Normative References

The following documents are referred to in the text in such a way that some or all of their content constitutes some of the requirements set out in this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

  • ASAM OpenDRIVE [1]

  • ASAM OpenCRG [2]

  • ISO 8855 [11]

  • ISO 8601 [4]

  • W3C XML Schema Definition Language [3]

3. Terms and definitions

Ego vehicle

Source: DIN SAE SPEC 91381 [12]

The vehicle(s) that is (are) the focus of a scenario, meaning the vehicle(s) under test. For evaluation of automated driving systems, the Ego vehicle is the vehicle controlled by the system-under-test. For human driver experiments, the Ego vehicle is the vehicle driven by the human driver. There may be zero, one, or multiple Ego vehicles within a scenario.

Parameterization

Source: DIN SAE SPEC 91381 [12]

The use of parameters, which are symbols that may be replaced by concrete values at a later stage according to either user needs or stochastic selection.

World

Source: DIN SAE SPEC 91381 [12]

Everything that falls within the spatial extent of a scenario and therefore may form a part of the scenario description.

4. Abbreviations

3D

Three-dimensional

ASAM

Association for Standardization of Automation and Measuring systems

CET

Central European Time

CRG

Curved Regular Grid

ECU

Electronic Control Unit

ENU

World reference frame "East, North, Up"

HTML

Hypertext Markup Language

OSC

ASAM OpenSCENARIO

OSI

Open Simulation Interface

SI

Systรฉme international (d' unitรฉs)

UML

Unified Modeling Language

XML

Extensible Markup Language

XSD

XML Schema Definition

XSLT

Extensible Stylesheet Language Transformation

5. Backward compatibility

ASAM OpenSCENARIO version v1.2 is fully backward compatible to v1.1 as well as v1.0. That means, there is no need for migration. A strict XML schema file without the deprecated elements is provided, so that deprecated elements can be removed manually.

6. General concepts

6.1. Architecture

ASAM OpenSCENARIO provides standardized descriptions of traffic situations for the purpose of simulation. Such descriptions represent executable scenarios that enforce a specific behavior during simulation runtime. For this reason, ASAM OpenSCENARIO covers two main aspects:

  • Designing a scenario (design time)

  • Executing a scenario (runtime)

The definition of system boundaries and the existence of an abstract runtime model are fundamental for the design of a meaningful scenario because they help bridge the gap between scenario designer and tool implementer. System boundaries delimit the standard’s scope by separating concepts covered by the standard from those concepts that are covered by external systems or definitions.

An abstract runtime model represents a basic contract between the author of a scenario and the provider of a simulation environment, together with a common idea about what should happen when a specific scenario is executed.

ASAM OpenSCENARIO does not describe all these aspects in detail. ASAM OpenSCENARIO provides a solution space and data model for defining traffic situations. The data model is supplemented with an abstract runtime model necessary to interpret interactions between the components at runtime.

6.1.1. Basic architecture components

The ASAM OpenSCENARIO architecture contains the following basic components:

  • An OpenSCENARIO Model Instance (OSC Model Instance) represents a scenario description in the solution space defined by the data model.

  • An OpenSCENARIO Director (OSC Director) is a component that interprets the OSC Model Instance and governs the progress of a scenario in a simulation. The OSC Director is the component responsible for running the scenario.

  • A Simulator Core. The Simulator Core is defined as all components other than OSC Director or OSC Model Instance that are needed to run a simulation. The Simulator Core is an external concept to ASAM OpenSCENARIO and provides an not standardized interface to the OSC Director for orchestrating the traffic situations defined in the scenario.

Figure 2 illustrates how the components interact:

image
Figure 2. ASAM OpenSCENARIO base architecture
This architecture is a simple abstraction to help understand how a scenario is coupled to a running simulation. It is not the intent of the ASAM OpenSCENARIO standard to prescribe a formal software architecture for simulator implementation. The provided architecture informally illustrates how components are separated and how interaction can be achieved. Implementation-specific details are not part of this architecture, even though the ideas and concepts might be useful when designing a simulation or designing a scenario.

6.1.2. ASAM OpenSCENARIO elements

OSC Director and Simulator Core both manage the lifecycle of elements within their respective scope. An element is an object instance that exists either in the OSC Director or in the Simulator Core and may change its state during the execution of a scenario. ASAM OpenSCENARIO clearly states which elements shall be encapsulated in an OSC Director and which elements are managed by a Simulator Core.

Elements of the OSC Director

The OSC Director manages the lifecycle of the following elements:

  • Storyboard (1 per scenario)

  • Story instances (0..* per Storyboard)

  • Act instances (1..* per Story)

  • ManeuverGroup instances (1..* per Act)

  • Maneuver instances (0..* per ManeuverGroup)

  • Event instances (1..* per Maneuver)

  • Action instances (1..* per Event)

The OSC Director performs the nested and concurrent execution of the elements above. This includes:

  • Forking into different execution paths.

  • Joining from different execution paths.

  • Loop execution (ManeuverGroup , Event) for maximumExecutionCount > 1.

Section 7.2 describes the runtime behavior of storyboard elements in detail.

Elements in the Simulator Core

ASAM OpenSCENARIO also requires an abstract understanding of elements that are not under the responsibility of the OSC Director at runtime. These are:

  • Entities representing traffic participants, such as vehicles and pedestrians

  • Environmental parameters, such as time of day, weather, and road conditions

  • Traffic signal controllers and traffic signals

  • Traffic objects, such as swarms of vehicles, sources for vehicles, and sinks of vehicles

  • Controllers: Default controllers, user-defined controllers like simulated drivers, drivers in the loop, or for the appearance of the ScenarioObject

  • Control strategies: Entity control instructions that originate from actions

  • Variables and user defined values

Element states

Elements generally have a set of property values at runtime. Because properties and relations, for example speed and position, may change during the simulation the complete set of property values and relations at a specific time represents the state of an element.

Static elements

A static element is a stateless component that does not change during runtime. Examples of static elements are the road network and road surface descriptions. These resources may be shared between OSC Director and Simulator Core.

6.1.3. Executing a scenario

Executing a scenario synchronizes the state of the elements in the OSC Director with the state of the elements in the Simulator Core.

The OSC Director interprets the OSC Model Instance at runtime, which translates in commands to the Simulator Core. The Simulator Core handles its elements, whose states are used by the OSC Director, to guide the developing scenario in the directions prescribed by the OSC Model Instance.

As an example, the SpeedCondition can be used via its application in a startTrigger to couple the speed of an entity managed by the Simulator Core to the start of an event that is managed by the OSC Director.

6.1.4. Actions and conditions

Actions and Conditions are abstract concepts that enable an OSC Director to interact with the Simulator Core and thus manage the ongoing simulation in accordance with the OSC Model Instance. Actions are used to manage the simulation by targeting the behavior of traffic simulation elements in Simulator Core. Conditions evaluate the state of traffic simulation elements in Simulator Core.

image
Figure 3. Actions and conditions
Figure 3 illustrates the idea behind the logical concepts. It is not an implementation recommendation or guideline and does not intended to represent interactions between programs or define software protocols. Condition evaluation, for example, could also be implemented with a publish-subscribe mechanism on the trigger level.

In ASAM OpenSCENARIO, actions are the exclusive mechanisms for controlling and modifying the content of a simulation. Conditions are the exclusive mechanisms for evaluating the status information of a simulation.

Actions are not the only factor influencing simulations. Other influencing factors are driver models, drivers-in-the-loop, and environmental conditions. These concepts are not defined in ASAM OpenSCENARIO.

In the same way, conditions cannot describe all quantified property values that exist in a simulation. Simulations can vary in scope and details of their simulated components. In order to be compatible with other simulation standards, ASAM OpenSCENARIO builds on high-level, abstract information that represents a common denominator for a majority of simulations. For example, a condition can be used to specify the speed of a vehicle, but not the speed of the vehicle’s left front wheel.

The ASAM OpenSCENARIO format is organic, meaning it may grow dependent on the used application. It can be expected that the scope of what is possible to use in conditions expands as the format grows. The same applies for actions. Actions and conditions are described in detail in Section 7.

6.1.5. Abstract ASAM OpenSCENARIO architecture

With the definition of actions and conditions, the logical interface between OSC Director and Simulator Core can be refined into an Apply Action Interface and an Evaluate Condition Interface. More generic interfaces are also required for general commands like initialize, starting, and stopping a simulation. Figure 4 illustrates the architecture of ASAM OpenSCENARIO.

image
Figure 4. Abstract ASAM OpenSCENARIO architecture
The architecture depicted in Figure 4 illustrates the logical relations between the identified components and interfaces. It is not meant to prescribe a formal software API.

6.2. Road networks and environment models

A scenario description may require references to a specific road network as well as inclusion of specific 3D models that represent the simulated environment visually. The definition of road network logic and/or environment 3D models is optional of ASAM OpenSCENARIO. Those references are established within the RoadNetwork language element. As an example, the ASAM OpenDRIVE file format is common when it comes to describing road network logic.

Scenario authors often need to refer to items defined in the road network, for example, to instruct a vehicle to drive in a specific lane. ASAM OpenSCENARIO does not impose its own naming system for these items; they should be referred with the names allocated by their own file format.

The following features of the road network may be addressed using ASAM OpenSCENARIO:

  • Individual road

  • Lane within a road

  • Traffic signal

  • Traffic signal controller

  • Road object

As mentioned before, a road network description supported by ASAM OpenSCENARIO is the ASAM OpenDRIVE format. This format describes the logical information related to road structure, such as road id, lane id, and road geometry. This information may be used to locate and position instances of Entity acting on the road and to position traffic participants. If ASAM OpenDRIVE is used to represent the road network, the ASAM OpenSCENARIO file should follow the ASAM OpenDRIVE conventions for numbering lanes.

In addition to the road network description, 3D models representing the environment may be referenced in a scenario description. Files containing 3D models provide the geometric and visual representation, like mesh and textures for elements of the virtual environment including the road surface. Use cases for 3D models referenced from scenarios are rendering, physical modeling, and sensor simulation. Files containing 3D models are considered to be external elements to the ASAM OpenSCENARIO format.

It is also possible to outsource some parts of the scenario description to an external Catalog file. The process for referencing external scenario parts is described in Section 9.4

6.3. Coordinate systems

In ASAM OpenSCENARIO, the following coordinate system types are defined:

  • A coordinate system that consists of three orthogonal directions associated with X, Y, and Z axes and a coordinate origin where axes meet, defines the right-handed Cartesian coordinate system. It is compliant with the ISO 8855:2011 [11] definition. Orientation of road objects is expressed extrinsically by the heading (yaw), pitch, and roll angles derived from the sequence of rotations in the order: Z-axis, then Y-axis, then X-axis. The positive rotation is assumed to be counter-clockwise ("right-hand rule", see Figure 5):

    image
    Figure 5. Heading, pitch, and roll angle in an ISO 8855:2011 compliant coordinate system
  • A road-based coordinate system that consists of two coordinate axes associated with the reference line of the corresponding road (s-axis) and the direction orthogonal to it (t-axis) and pointing leftwards. The definition of the s- and t-axes depends on the reference part of the road in use (see Figure 6):

    image
    Figure 6. Road-based s/t-coordinate system with origin at the beginning of the road
  • A coordinate system associated with positions on the earth and defined by the corresponding terrestrial reference system (geodetic datum) in use.

These coordinate system types are referenced to create the following coordinate systems:

6.3.1. World coordinate system (Xw, Yw, Zw)

Coordinate system of type (X, Y, Z) fixed in the inertial reference frame of the simulation environment, with Xw and Yw axes parallel to the ground plane and Zw axis pointing upward.

Neither origin nor orientation of the world coordinate system are defined by the ASAM OpenSCENARIO standard. If a road network is referenced from a scenario, the world coordinate system is aligned with the inertial coordinate system present in this description (in particular, the Zw-coordinate is assumed to consider a road elevation, an entire road super-elevation, or a lateral road shape profile).

6.3.2. Road coordinate system (s/t)

To every road specified in the road network definition document (external to ASAM OpenSCENARIO), there is a s/t-type coordinate system assigned. The road reference line defines the s-axis belonging to the (X,Y)-plane of the world coordinate system. The shape of the s-axis line is flat and determined by the geometry of the road projected on the (X,Y)-plane (Z-coordinates equal to 0). The origin of s-coordinates are fixed at the beginning of the road reference line and not affected by an elevation of the road (its inclination in the s-direction).

In contrast, multiple t-axes can be defined along the s-axis. Each t-axis points orthogonally leftwards to the s-axis direction and originates on the s-axis at the point with the concerned s-coordinate. All t-axes lie on the surface which is derived from the road surface as if its elevation were not considered. Therefore, t-axes adopt a lateral slope of the road as they are oriented coplanar to the road surface. As the consequence, t-coordinates are not affected by a superelevation of the road.

The following constraints are defined:

  • It is assumed the s-axis line has a smooth shape (no leaps nor kinks).

  • Being two-dimensional by its nature, the Road coordinate system does not define any vertical positioning. This means positions, specified with (s/t)-coordinates, are on the road surface.

  • Both s- and t-coordinates are applicable within boundaries of the respective road only.

  • In the case of multiple chained roads, each road defines its own s-axis.

  • In the case of roads with a complex lateral profile (for example, uneven surface), applicability and conversion of s/t-coordinates into other coordinate systems might appear problematic or even impossible.

6.3.3. Lane coordinate System (s/t)

To every lane specified in a lane section of a road (the road network definition document is external to ASAM OpenSCENARIO), there is a s/t-type coordinate system assigned. The lane’s center line defines the s-axis going in the middle between lane’s side boundaries throughout the whole lane section in the direction of the road’s s-axis. The shape of the s-axis line is determined by the geometry of the respective lane. The s-axis lies on the road surface and therefore takes into account an elevation of the road (its inclination in the s-direction). The origin of s-coordinates is fixed to the beginning of the lane section.

In contrast, multiple t-axes can be defined along the s-axis. Each t-axis points orthogonally leftwards to the s-axis direction and originates on the s-axis at the point with the concerned s-coordinate. All t-axes lie on the surface of the road and therefore adopt a lateral slope profile and an elevation of the road.

The following constraints are defined:

  • It is assumed the s-axis line has a smooth shape (no leaps nor kinks).

  • Being two-dimensional by its nature, the Lane coordinate system does not define any vertical positioning. This means positions, specified with (s/t)-coordinates, are on the road surface.

  • S-coordinates are applicable within the length of the respective lane section only.

  • T-coordinates are applicable within the width of the respective road only.

  • In the case, a road contains multiple lane sections, each lane section defines its own set of lanes with their own s-axes.

  • In the case of roads with a complex lateral profile (for example, uneven surface), applicability and conversion of s/t-coordinates into other coordinate systems might appear problematic or even impossible.

6.3.4. Vehicle coordinate system (Xv, Yv, Zv)

The vehicle axis system of type (X, Y, Z), as defined in ISO 8855:2011 [11], is fixed in the reference frame of the vehicle sprung mass. The Xv axis is horizontal and forwards with the vehicle at rest. The Xv axis is parallel to the vehicle’s longitudinal plane of symmetry. The Yv axis is perpendicular to the vehicle’s longitudinal plane of symmetry and points left. The Zv axis points upward.

In ASAM OpenSCENARIO, the origin of this coordinate system is derived by projecting the center of the vehicle’s rear axis to the ground plane at neutral load conditions. The origin remains fixed to the vehicle sprung mass, as illustrated in Figure 7.

image
Figure 7. Vehicle coordinate system

6.3.5. Pedestrian / MiscObject coordinate system (Xp/m , Yp/m , Zp/m)

The axis system for a pedestrian (subscript p) or a miscellaneous object (subscript m) is fixed in the reference frame of the object’s bounding box. The X axis is horizontal and normal to the object’s front plane. The Y axis is horizontal, perpendicular to X, and points to the left. The Z-axis points upward.

The origin of this coordinate system is derived from the geometrical center of the object’s bounding box under neutral load conditions (if applicable) projected onto the ground plane.

6.3.6. Trajectory coordinate system (s/t)

To every trajectory specified within the scenario, there is a s/t-type coordinate system assigned. The trajectory is deemed as an imaginary spatial directed line ("trajectory line") on the road surface indicating a movement path. The geometry of the trajectory line defines the s-axis course and shape. The origin of s-coordinates is fixed to the beginning of the trajectory line which can go through multiple chained roads.

In contrast, multiple t-axes can be defined along the s-axis. Each t-axis points orthogonally leftwards to the s-axis direction and originates on the s-axis at the point with the concerned s-coordinate. All t-axes lie on the surface of the road and therefore adopt a lateral slope profile and an elevation of the road.

The following constraints are defined:

  • Being two-dimensional by its nature, the Trajectory coordinate system does not define any vertical positioning. This means positions, specified with (s/t)-coordinates, are on the road surface.

  • S-coordinates are applicable within the length of the respective trajectory line only.

  • T-coordinates are applicable within boundaries of the respective road only.

  • If a trajectory line has a polyline shape, t-axes are undefined at points where the line has sharp kinks.

  • In the case of roads with a complex lateral profile (for example, uneven surface), applicability and conversion of s/t-coordinates into other coordinate systems might appear problematic or even impossible.

6.3.7. Geographic coordinate system (latitude, longitude, altitude)

ASAM OpenSCENARIO accepts position coordinates expressed in spherical geographic coordinate systems as longitude, latitude, and altitude. Interpretation of geographic coordinates might depend on the reference geoid model (datum) used in the geographic coordinate system and is therefore external to ASAM OpenSCENARIO.

The world coordinate system is considered the projected coordinate system compatible with the ENU (East, North, Up) convention of the X/Y/Z-axis directions and is derived from the used geographic coordinate system that is based on the applied geoid model. The (X,Y)-plane of the world coordinate system is assumed to be a local tangent plane in relation to the surface of the reference geoid model.

If coordinates of positions are derived from the geographic coordinate system, the road network definition shall specify the map projection system type involved and provide its mandatory parameters.

6.3.8. Positioning

ASAM OpenSCENARIO provides various ways to position or localize instances of Entity acting in the scenario:

  • Absolute in the world coordinate system

  • Absolute/relative in the geographic coordinate system

  • Relative to another Entity

  • Absolute/relative in the road coordinate system

  • Absolute/relative in the lane coordinate system

  • Relative to a Route

  • Relative to a Trajectory

6.4. Distances

ASAM OpenSCENARIO interprets distances in special ways. To properly use instances of Action and Condition, it is important to understand distance interpretation.

Depending on the use case, a distance may be specified between:

  • Two points

  • A point and an Entity (with or without bounding box considerations)

  • Two entities (with or without bounding box considerations)

The general term point used in this chapter may be replaced with the ASAM OpenSCENARIO specific term position. Within the scope of this chapter, both terms can be used interchangeably.

Distances in ASAM OpenSCENARIO may be measured in two ways:

  • From a local coordinate system, with lateral and longitudinal distance in an Entity, road, lane, or trajectory coordinate system

  • In absolute context, that is Euclidean distance

ASAM OpenSCENARIO assumes distances to be greater than equal to zero, (ℝ+0).

6.4.1. Visualization

If not otherwise stated, the three-dimensional Euclidean space (ℝ3) is used for distance measurement. In some cases and for better visualization, a two-dimensional space is used (ℝ2). In these cases, generalization for ℝ3 is provided.

For convenience, only one direction of travel is shown when visualizing a road, as shown in Figure 8.

image
Figure 8. Parts are not shown in road visualizations.

6.4.2. Referring to distances in ASAM OpenSCENARIO

In ASAM OpenSCENARIO, lateral and longitudinal distance depends on the type of referential, for example Entity, road, lane, or trajectory. Euclidean distance is measured in a global context.

6.4.3. Euclidean distance

Euclidean distance between two points in Euclidean space is the length of a line segment between those two points, as shown in Figure 9. It is unambiguously defined in ℝ3, independently from the coordinate system that describes the coordinates.

image
Figure 9. Euclidean distance dAB between two points A/B

6.4.4. Distances in an entity coordinate system

Given two points A = (XA , YA , ZA) and B = (XB , YB , ZB) in the coordinates of a specific Entity, the definition in ASAM OpenSCENARIO is:

  • Longitudinal Entity distance - (dXAB): |XB - XA |

  • Lateral Entity distance - (dYAB): |YB - YA |

image
Figure 10. Longitudinal entity distance dXAB and lateral entity distance dYAB between point A and point B in entity referentials

6.4.5. Distances in road coordinates

Given two points in road coordinates A = (sA , tA , hA) and B = (sB , tB , hB), the definition in ASAM OpenSCENARIO is:

  • Longitudinal road distance: dsAB: |sB - sA|

  • Lateral road distance: dtAB: |tB - tA|

image
Figure 11. Longitudinal road distance dsAB and lateral road distance dtAB between point A and point B in road referentials

6.4.6. Lane distance and trajectory distance

Distances based on the lane or trajectory referentials are measured using the same methods as distances measured in the road referential.

  • Distances measured in the lane referential use the lane center as a reference line, rather than the road reference line.

  • Distances measured in the trajectory referential use the trajectory as a reference line, rather than the road reference line.

Trajectories do not define a road plane and thus no lateral direction. Trajectories shall be projected onto a road or plane, depending on the definition for measuring unambiguous lateral trajectory distances.

6.4.7. Involving an entity in a distance calculation

In addition to distances between two points, ASAM OpenSCENARIO also support distance measurement between two entities or between an entity and a point. In both cases, it is important to identify the two points of interest and apply the distance concepts introduced in this chapter.

Identifying the point of interest for an Entity depends on the value of the Boolean attribute freeSpace. It determines whether the entities bounding box shall be taken into consideration (freeSpace = true), or shall not be taken into consideration (freeSpace = false).

freeSpace = false

In this case, the bounding boxes of the entity shall not be considered. The point of the entity used to calculate the distance is the entity’s origin. That means:

  • The distance between point P and Entity E is the distance between point P and Entity E’s origin (E0), as shown in Figure 12.

image
Figure 12. Distances between a point P and an entity E, with freespace = false

In this case, the bounding boxes of the Entity shall be considered. Which point is chosen depends on the desired distance type.

  • The distance between Entity E and Entity F is the distance between their origins (E0, F0), as shown in Figure 13.

image
Figure 13. Distances between an entity E and an entity F, with freespace = false.
freeSpace = true

For distances between entities and reference points:

  • In the Entity referential, if the desired distance is the Euclidean distance, then the point of interest is the point on the bounding box of the Entity which yields the lowest distance value to the reference point.

  • If the desired distance is longitudinal, then the point of interest is the point on the bounding box of the Entity that yields the lowest longitudinal distance to the reference point.

  • If the desired distance is lateral, then the point of interest is the point on the bounding box of the Entity that yields the lowest lateral distance to the reference point.

image
Figure 14. Distances between a point P and an entity E, with freespace = true.
If freeSpace = true, the distance between an Entity and a point on or in its bounding box is zero.

For distances between entities:

  • In the Entity referential, if the desired distance is the Euclidean distance, then the points of interest are the two points on the entities' bounding boxes that yield the lowest distance.

  • If the desired distance is longitudinal, then the points of interest are the two points on the entities' bounding boxes that yield the lowest longitudinal distance.

  • If the desired distance is lateral, then the points of interest are the two points on the entities' bounding boxes that yield the lowest lateral distance.

image
Figure 15. Distances between an entity E and an entity F, with freespace = true.
If freeSpace = true, the distance between two entities whose bounding boxes intersect is zero.

6.4.8. Guideline for positions on different roads

Longitudinal distance
Road coordinate system

The longitudinal distance can only be calculated when the path between start and target positions forms an unambiguous chain of consecutive road reference lines (s-axes). In the case of ambiguity, a helping route can be defined so that both start and target positions are found on the same route (see for more the section Section 6.4.8.3).

When calculating the longitudinal distance, breaks of road reference lines (also known as s-axes) of directly connected roads do not affect the result.

The longitudinal distance is calculated as a sum of lengths of segments along the chained road s-axes between projections of start and target positions on respective s-axes.

Lane coordinate system

The longitudinal distance can only be calculated when the path between start and target positions forms an unambiguous and continuous chain of consecutive lane center lines (also known as lane s-axes). In the case of ambiguity, a helping route can be defined so that both start and target positions can be found on the same route (see for more the "Helping route" section).

The longitudinal distance is calculated as a sum of lengths of segments along the chained lane s-axes between projections of start and target positions on respective s-axes.

Trajectory coordinate system

The longitudinal distance is calculated as a sum of lengths of segments along the trajectory’s s-axis between projections of start and target positions on the s-axis. In the case, a normal being conducted to the trajectory’s s-axis from the start or/and the target position does not intersect the s-axis, the remaining space before the beginning or/and after the ending of the trajectory’s s-axis is not included in the result and therefore considered as inaccuracy of calculations.

Lateral distance
Road coordinate system

The lateral distance can only be calculated when the path between start and target positions forms an unambiguous chain of consecutive road reference lines (also known as s-axes). In the case of ambiguity, a helping route can be defined so that both start and target positions can be found on the same route (see for more the "Helping route" section).

In the case, reference lines of connected roads along the chain are not contiguous, the lateral distance is not meaningful and therefore undefined.

The lateral distance is calculated with a method that depends on the case:

  • as the modulus of the difference between t-coordinates of the start and target positions on respective road t-axes if respective road s-axes are headed in the same direction;

  • as the modulus of the sum of t-coordinates of the start and target positions on respective road t-axes if respective road s-axes are headed in opposite directions.

Lane coordinate system

The lateral distance is undefined.

Trajectory coordinate system

The lateral distance is calculated as the modulus of the difference between t-coordinates of the start and target positions on respective trajectory t-axes. In the case, a normal being conducted to the trajectory’s s-axis from the start or/and the target position does not intersect the s-axis, the lateral distance is undefined.

Helping route

The helping route can be either a one which is assigned to the acting or triggering Entity within the scenario or a one which is calculated by a simulator. The preferred RoutingAlgorithm can be specified by means of several properties:

  • assignedRoute: Use the route which has already been assigned to the entity at the start position at the point in time when the distance shall be calculated.

  • fastest: Calculate the route with the shortest travelling time between the start and target positions.

  • leastIntersections: Calculate the route with as few junctions as possible between the start and target positions.

  • undefined: It is up to the simulator how to calculate the route between the start and target positions.

  • shortest: Calculate the route with the shortest path between the start and target positions.

It must be noted, in the case of complex road networks, the calculation of the helping route might not give a single result, that might lead to an unexpected distance looked for.

6.5. Speed

Speed is measured as the magnitude of the speed vector in the vehicle coordinate system, consisting of longitudinal and lateral speed components.

6.6. Controllers

Controller are elements of the simulation core that control the motion or appearance of a ScenarioObject. ASAM OpenSCENARIO does not specify how controllers work and how they are implemented. ASAM OpenSCENARIO considers a controller as a runtime element that is used to enforce the control strategies (see Section 7.4.1.1) assigned to instances of ScenarioObject.

Any number of Controller elements can be assigned to objects of type Vehicle or Pedestrian.

A Controller may be internal, as a part of the simulator, or external, defined in a file. The intended use cases for controllers are:

  • Specifying that a vehicle is controlled by the system under test.

  • Defining smart actor behavior, where a controller takes intelligent decisions in response to the road network or other actors. Hence, controllers can be used, for example, to make agents in a scenario behave in a human-like way.

  • Assigning a vehicle to direct human control.

By default, controllers are assigned in a deactivated state.

6.6.1. Controller types

ASAM OpenSCENARIO defines four different domains of a Controller:

  • Longitudinal

  • Lateral

  • Lighting

  • Animation

Where the longitudinal and lateral domains are controlling the movement of the ScenarioObject, whereas the lighting and animation domains are controlling the appearance of the ScenarioObject (see Section 6.7).

In the User Guide, when controllers are mentioned related to a moving action, it always relates to controllers in either the longitudinal, the lateral, or both domains.

ASAM OpenSCENARIO defines two types of controllers:

  • The default controller that enforces control strategies exactly as they are described by the actions

  • A user-defined controller that may have custom interpretations of control strategies

The default controller is expected to enforce control strategies along the entity domains that do not have a user defined controller.

ASAM OpenSCENARIO cannot prescribe the behavior of an user-defined controller. This means that simulations with user-defined controllers can differ from simulations generated using only default controllers, even though they use the same OSC Model Instance. This allows the scenario designer to use ASAM OpenSCENARIO in a broader scope, interpreting Action as suggestions rather than commands. Repeatable simulation results are only expected when using default controllers.

6.6.2. Controlling a scenario object

Any number of controllers can be assigned for the same ScenarioObject domain. However, only one controller can be activated for a domain at the time. If a controller is activated for a domain, it deactivates the currently active controller on that domain.

Activating a new controller does not interfere with the existing control strategy and the Action associated with that control strategy. Control strategies belong to the entity they are assigned to. Having a new controller does not change this. The new controller continues to enforce the existing control strategy just like the previous controller did. Figure 25 illustrates the coupling between controllers, entities, and control strategies.

6.6.3. Assigning a user-defined controller

A user-defined controller is assigned with the AssignControllerAction:

1
2
3
<AssignControllerAction>
    <Controller name="HAF_Driver" controllerType="movement"/>
</AssignControllerAction>

A user-defined controller may also be implicitly assigned by including it in the definition of a ScenarioObject, for example:

1
2
3
4
5
6
7
<ScenarioObject name="Ego">
    <CatalogReference catalogName="VehicleCatalog" entryName="car_white"/>
    <ObjectController>
        <Controller name="HAF_Driver" controllerType="movement"/>
        <Controller name="Light_Logic" controllerType="lighting"/>
    </ObjectController>
</ScenarioObject>

By default, controllers are assigned to entities in deactivated state.

6.6.4. Activating a user-defined controller

User-defined controllers are activated for a given domain, for example, longitudinal, or lateral. The following actions are used to activate controllers:

If multiple controllers are assigned for the same domain and ActivateControllerAction is used without the controllerRef, the last assigned controller is activated.
A Controller cannot be activated in a domain where it is not defined through the controllerType.
Although ASAM OpenSCENARIO allows to omit the controllerRef attribute for the sake of a backward compatibility if only a single controller is assigned (regardless implicitly or explicitly) to the concerned entity, it is considered not meaningful in case of multiple assigned controllers. This is expected to be addressed in one of the follow-up major versions, where the attribute shall be defined as mandatory to exclude an ambiguity in specifying the referenced controller.

6.6.5. Assigning the default controller

At runtime, all ScenarioObjects of type Pedestrian or Vehicle are assigned a default controller capable of enforcing control strategies. This controller shall not be assigned or unassigned by the OSC Model Instance.

6.6.6. Activating the default controller

The default controller cannot be activated or deactivated explicitly in the OSC Model Instance.

At runtime, the default controller is activated for a given domain if no user-defined controller is active for that domain. If a user-defined controller is activated for a domain, it automatically deactivates the default controller for that domain.

6.7. Appearance

ASAM OpenSCENARIO allows changing and controlling the Appearance of a ScenarioObject. The Appearance handles dynamic changes a ScenarioObject can undergo during a scenario. Hence, the color of a Vehicle is not controlled by the Appearance. The Appearance does not affect the position or change the effective BoundingBox of an ScenarioObject, only how it is perceived.

The Appearance is divided into two separate categories:

  • Light: controls the lights of a ScenarioObject

  • Animation: change the appearance of a ScenarioObject

ASAM OpenSCENARIO supports simple use cases, for example:

  • Turning the daytime running lights of a vehicle on or off

  • Turning the indicator light of a vehicle to flashing

  • Setting the special purpose lights of a police car to flashing

  • Opening the front left door of a vehicle

  • Folding in or out car side mirrors

  • Applying a motion like running to a pedestrian

To handle more complex modeling of either Light or Animation, a Controller of type lighting or animation can be used.

6.8. Routes

A Route is used to navigate instances of Entity through the road network based on a list of waypoints on the road that are linked in a specific order, resulting in directional route. A Waypoint consists of a position and a RouteStrategy. The RouteStrategy indicates how to reach the position. An Entity’s movement between the waypoints is created by the simulator which uses the RouteStrategy as constraint. There may be more than one way to travel between a pair of waypoints. If this is the case, the RouteStrategy specified in the target Waypoint shall be used.

The different available and simulator-specific options for RouteStrategy are:

  • Fastest: Selects the route with the shortest travelling time between start and target location.

  • Least intersections: Selects the route with as few junctions as possible between start and target location.

  • Random: It is up to the simulator how to reach the target location.

  • Shortest: Selects the route with the shortest path between start and target location.

If, for example, the RouteStrategy "shortest" results in multiple possible routes of equal lengths, it is up to the simulator which route to choose.

The following figure exemplifies the resulting routes dependent on the chosen RouteStrategy (e.g., either shortest or fastest) of the target waypoint. Moreover, the waypoint of a route does not affect the lateral position of an entity within a road when following the route.

image
Figure 16. Shortest and fastest route between two waypoints
The implementation of this strategy may vary between simulators. In order to create unambiguous routes, the user must specify a sufficient number of waypoints.

The reference line of a route consists of the road reference lines along the calculated path.

Instances of Route may be assigned to an Actor using AcquirePositionAction or AssignRouteAction. Once assigned, they remain in place until another action overwrites them. For more details, refer to Section 7.5.1.

An Actor is still considered "on the route" if it is on a road section that does not have a waypoint on it but is part of the route between waypoints as calculated at execution time.

If an entity approaches a junction and is not on a route, or is on a route that cannot be followed, the road to follow is selected randomly from the available options.

If an actors starts somewhere before the first waypoint on a route, two different outcomes are possible, depending on where the first waypoint is located:

  • If the first waypoint can be reached by the actor in its present state, then the first waypoint should be reached by the strategy defined for the first waypoint.

  • If the first waypoint cannot be reached by the actor in its present state, then the route should be ignored.

It is possible that an actor starts somewhere along a route and not at its first waypoint. There are two ways to proceed for the actor, depending on whether the route contains loops:

  • If the route does not contains loops, the actor ignores the part of the route ranging from the first waypoint of the route to the position where the actor enters the route. The actor follows the remaining part of the route starting at the actors current position.

  • If the route contains loops, it passes the same road section several times.

If the route contains loops, see Figure 17 for an example, some additional rules apply. The route in the example consists of four waypoints (shown in boxes) that are linked in a specific order. The part of the route highlighted in red is driven twice: once on the links between waypoints 1 and 3, and once on the links between Waypoints 3 and 5. To avoid the entity becoming stuck in a loop, the following rules apply:

  • Where an entity is on a road that belongs to more than one link between waypoints, the entity shall be treated as being on the earliest link which has not been followed yet.

    • If an entity joins the route just before Waypoint 2, it is treated as being on the link between Waypoint 1 and Waypoint 2 (and not between 3 and 4).

  • Instances of Entity only follow later links than the one they are currently on.

    • If an entity joins the route just after Waypoint 3, it goes towards Waypoint 4, then 5.

  • When an entity leaves then rejoins a route or reaches the final waypoint, any previously visited waypoints shall be ignored.

    • If an entity is teleported to waypoint 1 after reaching waypoint 4, it follows the route as if for the first time.

    image
    Figure 17. Route passing the same road section twice

When waypoints and the resulting ordered sequence of roads uniquely define the path from the start to target location, a position along the route can be defined in road or lane coordinates relative to the reference line of the road or lane. For this purpose, PositionInRoadCoordinates or PositionInLaneCoordinates can be used. An example of this is shown in Figure 18. Furthermore, it is assumed that a simulator makes a calculation so that the composite reference line of a route consists of the road reference lines along the calculated path.

image
Figure 18. A route consisting of roads with a reference line and PositionInRoadCoordinates

6.9. Trajectories

Instances of Trajectory are used to define an intended path for Entity motion in precise mathematical terms. The motion path may be specified using different mathematical shapes:

  • Polyline: A concatenation of simple line segments across a set of vertices.

  • Clothoid: Euler spiral, meaning a curve with linearly increasing curvature.

  • Non-Uniform Rational B-Splines (Nurbs) of arbitrary order.

By using nurbs, most relevant paths may be expressed either directly or with arbitrary approximation: Nurbs curves form a strict superset of the curves expressible as Bรฉzier curves, piecewise Bรฉzier curves, or non-rational B-Splines, which can be mapped to corresponding nurbs curves. Because nurbs curves directly support the expression of conic sections, such as circles and ellipses) approximation of, for example clothoids using arc spline approaches, is feasible.

Also, nurbs make it relatively easy to ensure continuity up to a given derivative: A nurbs curve of degree k, meaning order k+1, is infinitely continuously differentiable in the interior of each knot span and k-M-1 times continuously differentiable at a knot. M is the multiplicity of the knot, meaning the number of consecutive knot vector elements with the same value.

Commonly used nurbs curves are curves of quadratic (order = 3) and cubic (order = 4) degree. Higher-order curves are usually only required if continuity in higher derivatives needs to be ensured. Because the effort for evaluating curves increases with rising orders, it is recommended to restrict instances of Trajectory to lower orders.

Instances of Trajectory may be specified using just the three-positional dimensions along the X, Y, and Z axes (see Section 6.3 for coordinate system definitions). Alternatively, instances of Trajectory may also be specified using the three-positional dimensions and the three-rotational dimensions (heading, pitch and roll) for six total dimensions. In the second case, the path not only specifies the movement of the entity along the path, but also the orientation of the corresponding entity during that movement.

When a Trajectory is specified relative to the position of a moving entity, its absolute position cannot be calculated before the scenario starts. In this case, the trajectory must be calculated at runtime when the corresponding FollowTrajectoryAction is triggered.

Additionally, an instance of Trajectory may be specified with or without a time dimension, allowing for the combined or separate specification of the entities longitudinal domain: A trajectory incorporating the time dimension completely specifies the motion of the entity, including its speed. A trajectory without the time dimension does not specify the speed along the path. This approach allows for the separate control of speed.

A Trajectory provides a mathematically precise definition of a motion path. The corresponding entities behavior, however, depends on the actions employing it: Either an Entity follows this path exactly or it uses the path as a guidance for the controller to follow as best as the entities rules of motion allow.

The following sections describe edge cases in the definition of trajectories.

6.9.1. Entity is not at the start of trajectory, timeReference is not set

Starting conditions:

  • When the FollowTrajectoryAction starts, the entity is not at the beginning of the trajectory.

  • Time references are not set.

Expected behavior:

  • If the followingMode is position, the entity teleports to the beginning of the trajectory.

  • If the followingMode is follow, the controller attempts to steer as close to the trajectory as possible. Because the timeReference is not defined, the controller steers towards the point that bring the entity in line with the trajectory as soon as feasible. Considering the current position, orientation, and performance limitations of the entity, this is possibly not the start point of the trajectory, and maybe not even the geometrically closest point, as shown in Figure 19.

image
Figure 19. Entity is not at the start of the trajectory

6.9.2. Entity is not at the start of trajectory, timeReference is set (in the future)

Starting conditions:

  • When the FollowTrajectoryAction starts, the entity is not at the beginning of the trajectory.

  • The time reference is set at beginning of the trajectory (t1), the time reference is later than the current time (t < t1).

Expected behavior:

  • If the followingMode is position, the action starts, but the entity keeps moving as before until t1 is reached. At t = t1, the entity teleports to the start of the trajectory, and continues along the trajectory.

  • If the followingMode is follow, the entity immediately starts steering towards the trajectory, with the aim to be at the trajectory start at t = t1.

6.9.3. Entity is not at the start of trajectory, timeReference is set (in the past)

Starting conditions:

  • When the FollowTrajectoryAction starts, the entity is not at the beginning of the trajectory.

  • The time reference is set at beginning of the trajectory (t1), the time reference is earlier than the current time (t > t1).

Expected behavior:

  • If the followingMode is position, the entity behaves as if the trajectory starts at the position interpolated between the most recent time reference and the earliest future time reference. The entity teleports to that position and continues along the trajectory.

  • If the followingMode is follow, the entity starts steering towards the trajectory, aiming to hit the first referenced point in the future and taking into consideration the performance limitations.

6.9.4. Entity is at an ambiguous point near the trajectory

Starting conditions:

  • The entity is located in vicinity to more than one waypoint or segment connecting the waypoints.

Expected behavior:

  • The entity joins at the first possible segment, according to the user-defined orientation of the trajectory and respecting time references, if given. See section on Section 6.8 and previous points in this section.

image
Figure 20. Entity is at an ambiguous point near the trajectory

6.9.5. Trajectory-relative positions

Trajectory-relative positions may be defined using TrajectoryPosition, which define a position relative (and potentially offset) to the path of the trajectory. See Figure 21 for an example position along a linestring-defined trajectory.

image
Figure 21. Trajectory position example

6.10. Traffic simulation

In addition to deterministic behavior of instances of Entity, ASAM OpenSCENARIO also provides ways to define stochastic or not precisely defined behavior. This can be useful for the following purposes:

  • Make the scenario more realistic.

  • Induce variances into the scenario sequence.

  • Define traffic parameters, such as traffic density.

To define stochastic behavior, surrounding intelligent traffic agents may be defined using instances of TrafficAction. With the help of this action, the parameterization of traffic sources, traffic sinks, and traffic swarms may be specified.

The definition of a TrafficAction in ASAM OpenSCENARIO does not specify which maneuvers the intelligent traffic agents execute. Instead, those actions specify the initialization or termination of vehicles whose behavior is controlled by external traffic simulation models. Spawned traffic participants makes routing decisions based on their corresponding driver model, just as with the ActivateControllerAction.

6.11. Traffic signals

Traffic signals introduce two main aspects into simulation:

  1. Position and rendering of traffic signals and their possible state in a simulation. Locations are defined in the road network. Rendering is specific to the simulator.

  2. The dynamic behavior that describes how and when the traffic signals change during a simulation. This is defined in ASAM OpenSCENARIO with referencing the objects in the road network.

6.11.1. Traffic signal controllers

Traffic signal controllers provide identical states for one or more dynamic traffic signals. Controllers serve as wrappers for the behavior of a group of signals. TrafficSignalController instances are used for dynamic speed control on motorways and to control traffic light switching phases. ASAM OpenSCENARIO adds dynamic aspects, such as phases and durations, to the traffic controllers that are defined in the road network.

6.11.2. Traffic signal definition

Traffic signals are declared in the RoadNetwork section of a scenario file. TrafficSignalController instances are wrapped around their phases (go, attention, stop, etc.) and their traffic signal states (on, off, etc.). A TrafficSignalController references the ID of a signal controller instance in the road network, e.g., an ASAM OpenDRIVE controller, with the name attribute. If the road network format does not define signal controllers, then the name attribute of the TrafficSignalController is only its identifier for reference within the scenario.

1
2
3
4
5
6
7
8
9
<TrafficSignals>
    <TrafficSignalController name="RoadNetwork_ID1">
        ...
    </TrafficSignalController>
    <TrafficSignalController name="RoadNetwork_ID2">
        ...
    </TrafficSignalController>
    ...
</TrafficSignals>

6.11.3. Connecting traffic signal controllers

ASAM OpenSCENARIO provides an optional mechanism to connect the dynamic behavior of multiple TrafficSignalController instances. The TrafficSignalController defines a delay to a referenced signal controller. The referenced signal controller shall be defined in ASAM OpenSCENARIO with its dynamic behavior.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
<RoadNetwork>
    <LogicFile>
        ...
    </LogicFile>
    <SceneGraphFile>
        ...
    </SceneGraphFile>
    <TrafficSignals>
        <TrafficSignalController name="RoadNetwork_ID1">
            ...
        </TrafficSignalController>
        <TrafficSignalController name="RoadNetwork_ID2"
                                delay="10"
                                reference="RoadNetwork_ID1">
            ...
        </TrafficSignalController>
        ...
    </TrafficSignals>
    ...
</RoadNetwork>

6.11.4. Phases

TrafficSignalController provides an ordered list of Phase instances. A Phase represents a dynamic element of a TrafficSignalController and defines a duration and a name, which represents the semantic information of a Phase, e.g., go, attention, stop, etc. The simulation sequentially runs through the Phase instances of the declared TrafficSignalController while executing the scenario with respect to each duration. The list of Phase instances represents a cycle. That means, the first Phase repeats after the last Phase has ended. The duration of a cycle is the sum of the duration of the Phase instances. The first Phase starts with the execution of the storyboard.

Phase instances are connected to multiple instances of TrafficSignalState or one TrafficSignalGroupState. Because a TrafficSignalController can control multiple traffic signals, each traffic signal is represented by a state during a specific Phase.

In the current version, interpretation and notation of state are specific to the simulation engine used.

In the following example, the pedestrian traffic signals are encoded with Boolean values (on/off) and as a group because all traffic signals share the same state for every Phase:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<TrafficSignalController name="45">
    <Phase name="stop" duration="35">
        <TrafficSignalGroupState state="on;off"/>
    </Phase>
    <Phase name="go" duration="20">
        <TrafficSignalGroupState state="off;on"/>
    </Phase>
    <Phase name="stop" duration="17">
        <TrafficSignalGroupState state="on;off"/>
    </Phase>
</TrafficSignalController>

6.12. Variables

Variables in ASAM OpenSCENARIO are similar to variables in programming languages. They have the following characteristics:

  • Variables are defined in the scope of the whole scenario. All variables that are used in a scenario shall be defined in a VariableDeclaration.

  • Variables are named and typed. The same naming rules apply to variables as to parameters (see Section 9.1).

  • Variables have an initialization value. They are set to their initialization value at load time of the simulation.

Unlike parameter values (see Section 9.1), variable values can also change during runtime. This can be achieved in two ways:

  • From within the scenario (OSC Model instance) by using a VariableAction

  • From external side. For this, the Simulator Core needs to provide an interface to change variable values.

Variables are used in a scenario to trigger actions with a VariableCondition. A VariableCondition can also be used where the existing conditions cannot describe the value of the variable or the value needs to be injected from external side because it is not part of the scenario.

An example of a scenario action which is triggered by a VariableCondition could look like this:

<VariableDeclarations>
  <VariableDeclaration name="Trigger1" variableType="boolean" value="false"/>
</VariableDeclarations>
...
<Event name="ActivateControllerEvent" priority="overwrite">
  <Action name="ActivateControllerAction">
    <PrivateAction>
      <ControllerAction>
        <ActivateControllerAction controllerRef="Controller1" lateral="true" longitudinal="true"/>
      </ControllerAction>
    </PrivateAction>
  </Action>
  <StartTrigger>
    <ConditionGroup>
      <Condition name="ActivateControllerEventCondition" delay="0" conditionEdge="rising">
        <ByValueCondition>
          <VariableCondition variableRef="Trigger1" rule="equalTo" value="true"/>
        </ByValueCondition>
      </Condition>
    </ConditionGroup>
  </StartTrigger>
</Event>

Variables can also be read from external side during the scenario. For this, the Simulator Core needs to provide an interface to read variable values. An example of a VariableAction which triggers something on external side could look like this:

<Event name="SetTriggerEvent" priority="overwrite">
  <Action name="SetTrigger1">
    <GlobalAction>
      <VariableAction variableRef="Trigger1">
        <SetAction value="true"/>
      </VariableAction>
    </GlobalAction>
  </Action>
  <StartTrigger>
    <ConditionGroup>
      <Condition name="EgoReachSpeedCondition" delay="0" conditionEdge="rising">
        <ByEntityCondition>
          <TriggeringEntities triggeringEntitiesRule="any">
            <EntityRef entityRef="Ego"/>
          </TriggeringEntities>
          <EntityCondition>
            <SpeedCondition rule="greaterOrEqual" value="20"/>
          </EntityCondition>
        </ByEntityCondition>
      </Condition>
    </ConditionGroup>
  </StartTrigger>
</Event>

The standard defines a type inference check, which ensures that the variable value matches its type. The check is not ensured by the XML validator and therefore must be implemented by the simulator.

Variables can only be used in a VariableCondition to trigger actions during runtime of the scenario. They cannot replace any attribute value in the scenario or be used in expressions like parameters. This avoids unspecified behavior, e.g., changing the AbsoluteTargetSpeed of a SpeedAction during execution or changing the model3d of a Vehicle during runtime.

Interfacing with external modules can be achieved with UserDefinedValueCondition and UserDefinedAction in the same way.

6.13. Properties

Instances of Property may be used to define test-instance specific or use-case specific properties of ASAM OpenSCENARIO sub-elements. Properties are available for the following types:

  • Vehicle

  • Pedestrian

  • MiscObject

  • Controller

  • RoadCondition

  • FileHeader

Instances of Property are collected in the Properties container. Every Properties definition may contain one or more name-value pairs (meaning instances of Property) and/or references to external files using the File mechanism. Thus, properties are a powerful instrument for customizing scenarios, without the need of standardizing purpose-built features related to specific simulator, hardware, and software setups.

Typical applications of properties are extensions of vehicle dynamics specifications, additional driver behavior settings, color information of objects, etc.

Properties can influence scenario execution, for example the driver behavior, but scenarios shall be executable without knowledge of the properties meaning.

7. Components of a scenario

7.1. Overview of a scenario

To represent a traffic situation, an OSC Model Instance is built up of four main components:

  • Road network: mapping of the different driving surfaces and all relevant elements of the road infrastructure, like traffic signals.

  • Entities: road users, including vehicles, pedestrians, and other miscellaneous objects that interact during a scenario.

  • Actions: basic building blocks to define dynamic behavior of the entities. It may also be used to modify simulation states or components of the simulated world.

  • Triggers: mechanism that determines when an action starts or stops. It is built on logical expressions revolving around the states of entities or the simulation.

It is possible to design a scenario without a road network but it restricts the application of certain ASAM OpenSCENARIO actions.

The structure of the OSC Model Instance was created with the purpose to host and combine the main components listed above in such a way that rich driving scenarios can be defined. This chapter introduces the ASAM OpenSCENARIO structure, how the different components fit in the structure, and how these components relate to one another.

7.2. Storyboard and entities

7.2.1. Storyboard

In ASAM OpenSCENARIO, the storyboard covers the complete scenario description. The storyboard provides the answers to the questions "who" is doing "what" and "when" in a scenario. An ASAM OpenSCENARIO Storyboard element consists of the following elements:

  • Init: Initialization element that sets the initial states of the scenario elements, such as the position and speed of instances of Entity. It is not possible to specify conditional behavior in this section.

  • One or more Story elements (optional): Story elements enable scenario authors to group different scenario aspects into a higher-level hierarchy and thus create a structure for large scenarios.

  • stopTrigger: determines the end of the scenario.

Instances of Story in ASAM OpenSCENARIO contain Act instances, which in turn define conditional groups of Action instances. Each act focuses on answering the question "when" something happens in the timeline of its corresponding story. The act regulates the story via its startTrigger instance and its stopTrigger instance. If a startTrigger evaluates to true, the act’s ManeuverGroup instances are executed.

A ManeuverGroup element is part of the Act element and addresses the question of "who" is doing something, by assigning entities as Actors (see Section 7.3.1) in the included Maneuver instances. Maneuver groups may also include catalog references with predefined maneuvers. This concept is described in Section 9.4.

The Maneuver element defines "what" is happening in a scenario. A Maneuver is a container for Event instances that need to share a common scope. Events control the simulated world or the actors defined in their parent maneuver group. This is achieved through triggering Action instances, via user-defined Condition instances.

Figure 22 illustrates the components of a storyboard.

image
Figure 22. Diagram showing the structure of a storyboard

7.2.2. Entities

In a scenario, instances of Entity are the participants that make up the developing traffic situation. Vehicle, Pedestrian, and MiscObjects instances may change their location dynamically. A MiscObject instance represents an object, such as tree or pole. The possible categories are identical to the ones that are defined in ASAM OpenDRIVE. If an object is already defined in the road network file, it can be instantiated in the scenario as Entity as ExternalObjectReference.

Instances of Entity may be specified in the scenario format but the properties are specific to their type. For example, a Vehicle is an instance of Entity that has properties like vehicleCategory and performance. In contrast, a Pedestrian is specified by a property pedestrianCategory.

Where applicable, actions may change the state of an entity, for example, its position, speed or its associated Controller instances. The state of an entity may be queried to trigger an action, via a condition.

ASAM OpenSCENARIO and entity can be represented by any of these two model elements:

  • Entity describes one specific object

  • EntitySelection describes a list of instances of Entity

Motion control for entities

The motion of the entity types Vehicle and Pedestrian may be controlled with user-assigned controllers or a default controller.

The default controller is expected to execute the control strategies (Section 7.4.1.1) defined by the ASAM OpenSCENARIO MotionControlAction elements. The control strategies of the default controller are to maintain speed and lane offset of the entity. The control strategies of the default controller are called default control strategies.

The default controller is assigned to an entity’s motion domain (lateral and/or longitudinal) if:

  • No user assigned controller are running.

  • A user assigned controller is running but only controls one motion domain. In this case, the default controller is assigned to the remaining motion domain.

Entity selections

The EntitySelection element may be used to conveniently define groups of Entity instances in the scenario. In most cases, the entities may be used where single instances of Entity may be used as well, allowing actions to be applied to many ScenarioObject instances at once or to use their aggregated information ("any", "all") in a condition.

Entity selections may also be purposefully formed from any combination of objects within the scenario. Example: A named EntitySelection instance is chosen as an actor in a maneuver group. In this way, all private actions within the maneuver group are applied individually, to each ScenarioObject instance in the entity selection.

EntitySelection instances may be defined in such a way that they include other EntitySelection instances. Circular dependencies can be formed as a result. For example, EntitySelection A includes EntitySelection B which includes EntitySelection A.

Declaring EntitySelections with circular dependencies is highly discouraged and may lead to unexpected behavior.

Spawned objects

An entity may be represented by a single ScenarioObject instance or by an EntitySelection instance. Both, ScenarioObject and EntitySelection instances, are declared in the scenario file and are globally identified by their name attribute when they are used in actions and conditions. An entity may also be represented by a SpawnedObject instance which is created by a traffic source. These objects are created dynamically and have no static name that would enable a scenario author to reference them explicitly in a defined entity condition or in a private action.

Because spawned objects are considered to be of type vehicle, they may nevertheless be used as actors in an entity selection. To do so, the ByType option is used:

1
2
3
4
5
<EntitySelection name="allVehicle">
  <Members>
    <ByType objectType="vehicle"/>
  </Members>
</EntitySelection>

Spawned objects are created dynamically and do not appear in the OSC Model Instance. Therefore, SpawnedObject is stereotyped with <<transient>> in the UML model. The existence of SpawnedObject in the model is therefore a reminder that an Entity instance is not limited to be represented by a declared Entity or by an declared EntitySelection.

In future versions, SpawnedObject instances may be dynamically identifiable by following a standardized naming schema that takes in consideration the ID of the traffic source, for example NamedTrafficSource.entity_1.

Entity class hierarchy

The Entity class hierarchy provides an overview of the relations between Entity, EntitySelection, EntityRef and SpawnedObject.

image
Figure 23. The entity class hierarchy

The following relations can be inferred from Figure 23:

  • An Entity may be represented by either a single ScenarioObject, a EntitySelection, or SpawnedObject.

  • An EntitySelection may include members. members may be represented by a static list of named Entity instances (via EntityRef) or by a dynamic list of Entity instances that are defined by the type of the Entity (via ByType).

  • An EntitySelection may recursively include other Entity instances (via EntitySelection).

Generalization of entities

ASAM OpenSCENARIO relates the Vehicle, Pedestrian, MiscObject, and EntitySelection classes in the generalized concept Entity. This is useful because the concept of entity provides the building blocks for many actions and conditions - for example: A CollisionCondition instance can model the collision between a Vehicle instance and a MiscObject instance, such as a tree. With the use of other actions and conditions, this leads to some overgeneralization. Speeding up a MiscObject of type tree with a SpeedAction instance, for example, would contradict the common understanding of the reality that should be respected when creating a scenario.

This overgeneralization requires constraints that explicitly regulate what makes sense and what does not.

This includes:

  • Restrictions on actions and conditions that are not applicable to Pedestrian, MiscObject, or ExternalObjectReference instances or to entity selections containing these instances.

  • Restrictions concerning the multiplicity of a referenced Entity:

    • For a RelativeTargetLane, it is not clear in which exact lane multiple ScenarioObject instances that are grouped by an EntitySelection are located.

    • The interpretation of the distance to an EntitySelection is ambiguous. This is related to the question what the center or the bounding box of an EntitySelection is.

      In these cases, aggregation functions (average, max, min) might not be useful or even confusing. A reference to an Entity should be restricted to an instance of a ScenarioObject for such cases.

3D models for entities

The property model3d can be defined for the following entity types:

  • Vehicle

  • Pedestrian

  • MiscObject

The model3d property refers to either a model name or a path to a 3D model. 3D-model types are, for example, .GLTF, .FBX, .3DS. model3d is an optional property and therefore, even if it is specified in a OSC Model Instance, it maybe ignored, depending on the simulator’s support for this feature.

Figure 24 showcases the expected behavior depending on the simulator support for the model3d feature:

image
Figure 24. model3d behavior depending on simulator support

7.3. ManeuverGroups, Events and Maneuvers

7.3.1. ManeuverGroups and Actors

A maneuver group singles out the instances of Entity that may be actuated, or referenced to, by the maneuvers in that group. These instances of Entity are grouped and referred to as the Actors, because they play a role in the maneuvers to come. The Actors group may be left empty. This is allowed for situations where the maneuvers in a maneuver group lead to actions that are not related to instances of Entity, but instead world or simulation states.

An actor is defined using the EntityRef element. This element is then combined in an unbounded list to specify actors for a given maneuver group. A list of Actor instances may contain several instantiations of the type EntityRef. Additionally, extra instances of Entity may be added to the actors’s list, at trigger time, if the selectTriggeringEntities option is active.

The EntityRef element explicitly couples an existing entity to an actor in the maneuver group. This is achieved by specifying the name of the desired entity in the element. EntityRef is used when the entity of interest is known when the scenario is defined.

The selectTriggeringEntities property may be used when the choice of actors depends on runtime information and cannot be made at scenario definition time. When the selectTriggeringEntities property is true, entities become actors if they fulfill the following criteria:

  • The states of the instances of Entity are used by the logical expressions in Conditions.

  • The Conditions using the states evaluate to true.

  • The Conditions using the states are contained in ConditionGroups that evaluate to true.

Condition groups relevant for determining which instances of Entity are added to the actors, are located in the maneuver groups parent Act. The maneuver group inherits its parent act’s start trigger.

EntityRef may be combined with selectTriggeringEntities set to true. In this case, the resulting actors are the union of the two.

Finally, a ManeuverGroup instance is defined with a maximumExecutionCount. This setting specifies how many times the maneuver group runs, and is explained in Section 8.4.4.

7.3.2. Events

Actions are singular elements that may need to be combined to create meaningful behavior in a scenario. This behavior is created by the type Event which serves as a container for actions. Events also incorporate start triggers. The event start trigger determines when the event starts and when the actions contained in the event, start.

Actions shall always be wrapped by events with only one exception: In the InitActions class, where actions are declared individually.

The maximumExecutionCount setting specifies how many times an event is supposed to run. Interpretation of this parameter in runtime is explained in Section 8.4.2 .

An event is also parameterized with a definition of priority relatively to events that coexist in the same scope, i.e. maneuver. Whenever an event is started, the Priority parameter is taken into consideration to determine what happens to already ongoing events in the same maneuver. The three choices of the Priority parameter are:

  • override: All other events in the scope are stopped and the event starts.

  • skip: The event does not leave the standbyState.

  • parallel: The event starts regardless of any other running events.

Refer to Section 8.4.2.2 for the runtime interpretation of the Priority parameter.

Each event defined in a scenario corresponds to a single runtime instantiation which implies that there shall not be multiple instantiations of the same event running simultaneously. This also means that start triggers only make sense for events in standbyState, as opposed to each start trigger starting a new instantiation of the event.

7.3.3. Maneuver

A maneuver groups events creating a scope where the events can interact with each other using the event priority rules. The definition of a maneuver may be outsourced to a catalog and parameterized for easy reuse in a variety of scenarios.

7.4. Actions

Actions enable ASAM OpenSCENARIO to prescribe element behavior in traffic simulations or to directly affect element states, which in turn determine how a simulation evolves. An Action instance is defined in a OSC Model Instance.

There are three categories of Action:

  • Private actions are applied to entities, such as traffic participants. Either in the init section, before to the start of the simulation, or during the simulation when entities are represented by actors in a maneuver group.

  • Global actions are intended to modify non-entity related traffic simulation elements like time of day, weather conditions, or traffic signal states.

  • User-defined actions represent a customized contract between a scenario designer and a simulation provider. They realize specific behavior in the simulation that is otherwise not supported in ASAM OpenSCENARIO, by the existing actions.

In the initialization phase of a scenario, actions are responsible for setting up initial states of dynamic objects, environment, or infrastructure. In any later phase of the scenario, actions are executed when events are triggered.

7.4.1. Private action

Private actions shall be assigned to instances of Entity. These actions may affect motion control for their designated entity:

  • Prescribing intended dynamic behavior, for example, a LaneChangeAction instance specifies transition dynamics to describe how the lane change should be performed in respect to time or distance.

  • Directly setting entity states, for example, position.

Dynamic behavior implied by a private action is called a control strategy and is assigned to the entity when the private action is instantiated.

Control strategy

A control strategy is how an OSC Director assigns behavior to a simulated entity. A control strategy is not a component of the OSC Model Instance, existing only at runtime as a manifestation of a private action, in the Simulator Core. In simpler terms, a control strategy is the runtime mapping of an OSC Director PrivateAction instance to the Simulator Core.

The following guiding principles apply for private actions and control strategies:

  • Control strategies exist only in the simulator core and are not a part of the ASAM OpenSCENARIO model.

  • Only private action shall be mapped to control strategies.

    • Only those private actions that prescribe behavior, rather than setting states, shall be mapped to control strategies.

  • The control strategy is assigned to the entity when the private action is instantiated.

  • A private action does not control an entity - controllers control entities.

    • A controller controls an entity by enforcing the behavior prescribed by the control strategies assigned to that entity.

  • A private action reaches the complete state when its associated control strategy is finished, regardless of how it is finished - successfully, due to an override, or because of missing prerequisites. For information on runtime states, see Section 8.1.

    • A private action may also reach the complete state if it is terminated by its parent event, or the stop triggers of the enclosing act or storyboard. If this occurs, the associated control strategy is unassigned from the concerned entity.

All entities shall have a control strategy for the longitudinal and lateral domains assigned at all times. If no control strategies are explicitly assigned to the entity, then the entities are expected to activate default control strategies that define default behavior. The default controller enacts the default control strategies. Each entity control domain shall have a default control strategy:

  • Lateral domain: The default control strategy is to keep the lane and the entity’s offset on the lane. If the entity has an assigned route, the active controller uses that information to resolve ambiguity (intersection, merging roads, exits). If the ambiguity cannot be resolved, the control strategy changes to keep the direction defined by the entity’s current orientation.

  • Longitudinal domain: The default control strategy is to keep the entity’s current speed by controlling the length of the vehicle’s speed vector.

  • Lighting domain: Lights turned off

  • Animation domain: Animations off

image
Figure 25. Relations between Entity, Controller, privateAction, and control strategy
Private actions and motion control

Some configurations of private actions affect the motion control of an entity and therefore need to assign a control strategy . These actions are called MotionControl actions. Actions of type MotionControl are modeled with the MotionControl stereotype.

  • Motion control actions that assign a control strategy: SynchronizeAction, LaneChangeAction, LaneOffsetAction, LateralDistanceAction, SpeedAction, SpeedProfileAction, LongitudinalDistanceAction.

  • Non-motion control actions that do not assign a control strategy: VisibilityAction, ActivateControllerAction, AssignControllerAction,OverrideControllerValueAction, TeleportAction, RoutingAction, GlobalAction.

LaneChangeActions, SpeedAction, LaneOffsetAction may be used to set a state, if used with the step dynamic option. In this particular use case, these actions do not assign a control strategy as the changes are enacted instantaneously.

Types of private action

The following types of private action exist:

LongitudinalAction

Controlling speed or relative distance to a target. Instances of SpeedAction are defined, for example, by an acceleration profile (DynamicsShape) whereas instances of longitudinalDistanceAction are set up by means of actual distance or a headway time, for example, using timeGap.

For the element SpeedAction, when the DynamicsShape attribute is set to step, the speed is set instantaneously - not over time.

SpeedProfileAction provides a flexible way to define multiple speed changes over time, with acceleration and jerk settings optionally taken into account.

LateralAction

When using instances of LaneChangeAction or LaneOffsetAction, a lateral position within a lane can be targeted. Both actions support relative and absolute referencing of the action target. For the LaneChangeAction type, relative target referencing works differently than absolute referencing. The reference entities' x-axis serves as reference direction. The speed direction (forward / backward) of the reference entity is not relevant for the reference direction. Lane changes are evaluated positive if they are aligned with the reference entities' positive y-axis. A positive lane change moves the corresponding actor to the next lane in the reference entities' positive y-axis direction. For ASAM OpenDRIVE maps, the road center lane is not counted as a lane and thus not considered in this counting. The approach is similar for the LaneOffsetAction type: Positive offset values are aligned with the reference entities' positive y-axis. Finally, with the LateralDistanceAction type, a lateral distance to an object can be targeted. For each of the LateralAction types, the lateral dynamics may be restricted.

For the LaneChangeAction type, when the DynamicsShape attribute is set to step, the lane change is performed instantaneously - not over time. In the LaneOffsetAction case, when the DynamicsShape attribute is set to step, the displacement required to achieve the desired lane offset is performed instantaneously - not over time.

VisibilityAction

Enabling/disabling detectability of an entity by sensors or other traffic participants and visibility in the image generator.

SynchronizeAction

Takes over longitudinal control of an entity to reach a desired position at the same time a reference entity reaches a given reference position. The controlled entity is expected to regulate its speed, in relation to the reference entity, to meet the explicit position constraint and implicit time constraint. Optionally, in addition to the desired position, the controlled entity may also be given a FinalSpeed setting. This is the speed that the controlled entity shall have when reaching the destination. This final speed may be specified either as an absolute value or relative to the reference entity.

The synchronize action shall terminate when any one of the following occurs:

  • When the controlled entity reaches the reference position, regardless of the states and position of the reference entity.

  • When it is concluded that the controlled entity cannot reach its destination for whatever reason.

The synchronize action does not influence routing or the lateral behavior of the controlled entity. In other words, the destination should lie along the planned route of the entity as defined by the default behavior or additional actions.

The purpose of the synchronize action is to achieve specific repeatable traffic situations, which are tolerant to flexible initial conditions and unpredicted vehicle behavior, for example, in case of a human driver in the loop.

The example in Figure 26 shows how a synchronize action may be used to provoke an interception situation in an intersection. The dots indicate the respective destinations, which is also the point at which the synchronize action ends.

The controlled entity (c1, yellow) arrives at its destination, indicated by a yellow dot, whenever the reference entity (ego, blue) arrives at its destination, indicated by a blue dot. The synchronize action terminates at this point and synchronization stops. The controlled entity then moves into the intersection according to default behavior or any other active action, causing a dangerous situation for the reference entity, which still has a chance to avoid collision.

image
Figure 26. SynchronizeAction example inducing an interceptor situation

Figure 27 shows a scenario very similar to the previous example, but illustrates that the synchronize action also works when the controlled entity performs lateral operations in parallel, for example, following an assigned route or performing lane changes.

image
Figure 27. Example of SynchronizeAction combined with routing

Figure 28 shows a vehicle surrounded by other vehicles. The synchronize action is useful to form constellations at specific locations on the road network, typically before a critical event - for example lead vehicle brakes.

image
Figure 28. SynchronizeAction constellation example

In this case, there are four controlled instances of entity (c[1-4]), each one having an individual synchronizeAction referring to the blue ego car.

ActivateControllerAction (deprecated)

Explicitly (de-)activating a Controller model. This may be done for longitudinal, lateral, or both domains. This Action is deprecated and its functionality has been moved to the ControllerAction class.

ControllerAction

Assigning a driver model to instances of entity of type Vehicle, a model controlling motion behavior for other moving instances of entity, or an animation scheme, for example, a policeman. The controller action may also be used to override control signals, for example, apply the brakes. Additionally, a controller action may be used to activate or deactivate controllers assigned to entities on the lateral domain, longitudinal domain, lighting domain, animation domain, or all domains simultaneously.

TeleportAction

Defining a location or destination of an entity in the scenario. The target position may be described as absolute coordinates or relative to other instances of entity.

RoutingAction

Specifies the route that an entity should follow. There are three ways of specifying a routing:

  • AssignRouteAction: Using waypoints on the road network and a RouteStrategy.

  • FollowTrajectoryAction: Using vertices, timings (optionally), and a corresponding interpolation strategy.

  • AcquirePositionAction: Specifying a target position for the corresponding entity to reach. The entity aims to take the shortest distance from the current position to the target position along the road network.

AppearanceAction

Grouping actions that do not change the position or speed of an entity or modify the controller of an entity, but have an impact on the appearance of an entity. There are two ways of specifying a change in appearance:

  • AnimationAction: Using an AnimationType to animate a component of an entity, for example, opening the front left door of a vehicle or a pedestrian’s motion and gestures.

  • LightStateAction: Using a LightType and LightState to change the lights of an entity, for example, turning on the daytime running lights of a vehicle.

    1
    2
    3
    4
    5
    6
    7
    8
    
    <AppearanceAction>
        <LightStateAction>
            <LightType>
                <VehicleLight vehicleLightType="daytimeRunningLights"/>
            </LightType>
            <LightState state="on"/>
        </LightStateAction>
    </AppearanceAction>
    

7.4.2. Global action

The GlobalAction type is used to set or modify non-entity-related quantities.

EnvironmentAction

Setting weather state, road condition, and time.

EntityAction

Removing or adding instances of Entity.

VariableAction

Setting or modifying values of variables.

InfrastructureAction

Setting or modifying the state of a traffic signal or a traffic signal controller phase.

TrafficAction

Managing ambient traffic of the following kinds:

  • Creation of sources and sinks

    • A source creates vehicles, whereas a sink deletes vehicles. A source spawns new vehicles with the rate defined in the element. If no rate is given, a sink deletes all vehicles reaching its area of influence, but a rate may be defined to specify a maximum amount of vehicles to be removed per second. Removal of vehicles follows the "first in, first out" principle.

    • An optional TrafficDefinition of a sink is the equivalent of a forbidden list, meaning that only vehicles matching this list are removed while all other vehicles may pass unhindered. However, if no definition is given, all vehicles reaching the sink are removed.

  • Creation of swarm traffic following/surrounding a central object (see Figure 29)

    • Swarm traffic is set up in the area between inner radius and outline of the ellipsis defined by the two semi-axis attributes (blue area in the picture). The blue area shall never contain more swarm vehicles than defined in the numberOfVehicles. If a vehicle is leaving the blue area it is deleted and a new vehicle is spawned instead.

      image
      Figure 29. Swarm definition
    • Vehicles spawned by a TrafficSwarmAction instance may trigger conditions just as other instances of entities do. They may also perform actions by being referred to through an entity trigger, when identifying the actors in a maneuver group. Because the names of the spawned vehicles are determined in runtime, no actions can be modeled by referring to these entities.

    • Spawned vehicles make routing decisions based on their driver model, just as with the ActivateControllerAction. Optionally, a starting speed for the spawned vehicles may be specified. If no speed is given, the speed limit of the underlying road is used. This can lead to undefined behavior because there may be no speed limit defined for the road in the underlying road network file. To prevent errors, either a speed of the created vehicle should be defined or road network files should be used that have a speed limit defined. All elements make use of a TrafficDefinition, where the distribution of the spawned or removed vehicles may be defined using VehicleCategoryDistribution. Which vehicles of that category are actually spawned is up to the simulation engine.

  • Terminating any of the above traffic generation methods with an instance of the TrafficStopAction element.

7.4.3. User-defined action

The UserDefinedActions type enables user customized actions. When user-defined actions are used, the executability of the scenario dependents on the ability of the specific simulation environment recognizing these actions.

CustomCommandAction

Users may create their own actions which may incorporate a command or a script file.

7.5. Actions at runtime

7.5.1. Conflicting actions

At runtime, it may occur that coexisting actions end up competing for the same resource thus creating a conflict. A typical example: An action that controls an entity’s speed clashes with a newly triggered action that tries to control the speed of the same entity.

When an action acts on an entity selection and there is a conflict for one entity, all other instances of Entity within the selection are also treated as being in conflict. Actions are treated as conflicting if they are competing for control of the same domain in the same resource. For example, a SpeedAction always conflicts with any other SpeedAction if both target the same entity. Conflicts of actions of different types depend on how the actions relate to each other and need to be identified in a case-by-case basis. Table 7 and Table 8 depict the possible runtime conflicts between actions of different types.

If it is determined that a newly triggered action conflicts with a currently ongoing action, the latter is overridden. Overriding a running action is equivalent to issuing a stop trigger to that action, see Section 7.6.

7.5.2. Completing an action

For synchronizing the forked and nested execution paths of instances of storyboard elements, such as Story, Act, ManeuverGroup, Maneuver, Event, it is necessary to determine how an action is completed.

Private actions that assign control strategies are complete when the goal prescribed by the control strategy is reached. Enforcing a control strategy is done over time and, actions that assign control strategies take simulation time to complete.

All actions that do not assign control strategies are completed immediately. These actions transition from runningState to completeState, when instantiated, because the tasks associated to such actions are performed instantaneously.

The end criteria for actions are depicted in Table 7, Table 8, and Table 9.

Completing a private action

A private actions may be completed as follows:

  • Regular ending: A regular ending implies endTransition from the runningState to the completeState. An action ends regularly when its goal is accomplished, for example, an instance of a SpeedAction ends when the speed is reached. An action ends regularly if its goal is accomplished upon the start of the action, for example, the entity is traveling at the desired speed when an instance of a SpeedAction starts. The end criteria are depicted in Table 7.

  • Override by another Action: A private action that defines a control strategy on a specific domain of an entity is overridden by another action that defines a control strategy on the same domain of the same entity. The overridden action moves to the completeState with a stopTransition. For example, an instance of FollowTrajectoryAction overrides an instance of LaneChangeAction on an entity. The LaneChangeAction instance is stopped.

  • Override by Event: An event which is stopped is forced to stop all actions in its scope. The concerned actions move to the completeState with a stopTransition. To understand how an event can be stopped, see Section 7.3.2.

  • StopTrigger: A StopTrigger instance originating from the a storyboard or the action’s parent act. The action moves to the completeState with a stopTransition.

  • Missing prerequisites: The prerequisites for running an action are not fulfilled either during execution of the action or when the action starts. The action moves to the completeState with a stopTransition. For example, if the referenced entity of an instance of a LongitudinalDistanceAction disappears, or a private action is instantiated with no actors, the action is considered to be missing prerequisites.

Action prerequisites

Missing prerequisites are one reason why actions may be stopped. Prerequisites are specific to the action type and are the components or information required for the action to run. An action that is missing prerequisites, at start or during execution, is supposed to move to the completeState with a stopTransition. For example, an instance of a LaneChangeAction has these prerequisites: an existing lane and an entity to change lane with.

Executing actions depends on the robustness of the simulation engine and on the legitimacy of the OSC Model Instance. The ASAM OpenSCENARIO format specifies how actions work and how they interact with each other - it cannot and does not classify a OSC Model Instance as wrong or right, appropriate or not appropriate. In ASAM OpenSCENARIO, the only indicator that an action could not be completed regularly, is the 'stop' transition that is taken while entering the completeState. It is up to the implementation of the simulator to warn the users about potential unintended behavior, for example, teleporting a non-existing entity, assigning conflicting control strategies simultaneously, or referencing unintended entities.
  • PrivateAction
    A general prerequisite for private actions is that the actor is a valid entity.

    • LongitudinalAction

      • SpeedAction
        If followingMode is follow, then the target speed must be equal or less than the maxSpeed defined in the Performance of the actor.

      • LongitudinalDistanceAction
        Referenced entity exists. Referenced entity is on the route of the actor.

    • LateralAction

      • LaneChangeAction
        Target lane exists.

      • LaneOffsetAction
        Target lane exists.

      • LateralDistanceAction
        Referenced entity exists.

    • SynchronizeAction
      Referenced master entity exists.
      finalSpeed is equal or less than the maxSpeed defined in the Performance of the actor.
      The referred positions are valid reachable positions on a road.

    • ControllerAction

      • OverrideControllerValueAction
        At least one movement Controller exists for this actor.

      • ActivateControllerAction
        Referenced Controller exists.
        Referenced Controller is defined for the domains which shall be activated.

      • AssignControllerAction
        Referenced Controller exists.

    • RoutingAction

      • AssignRouteAction
        CatalogReference exists.
        Waypoint instances are valid positions on roads.

      • FollowTrajectoryAction
        CatalogReference exists and is on roads.

      • AcquirePositionAction
        Position is on a road.

    • AppearanceAction

      • AnimationAction
        AnimationType exists.

      • LightStateAction
        VehicleLightType exists.

  • GlobalAction

    • EntityAction

      • AddEntityAction
        Entity with this name reference has not been added yet.

      • DeleteEntityAction
        Entity with this name reference has not been deleted yet.

    • VariableAction

      • VariableSetAction
        Referenced variable exists.

      • VariableModifyAction
        Referenced variable exists.

    • InfrastructureAction

      • TrafficSignalControllerAction
        Referenced controller is defined in scenario.

      • TrafficSignalStateAction
        Referenced traffic signal is defined in road network file.

7.5.3. Continuous actions

Some private actions lack a regular ending by design. Their underlying control strategy pursues a permanent goal that is supposed to be continuously tracked over time. These private actions are often referred to as never-ending actions or continuous actions.

Private action types like LongitudinalDistanceAction, LateralDistanceAction, LaneOffsetAction, and SpeedAction forfeit a regular ending when a scenario designer sets the continuous flag to true. This also applies to AnimationStateAction with flag loop set to true and LightStateAction with LightMode set to flashing. These are the only cases of never-ending actions.

All action ends described in Section 7.5.2.1 are applicable to never-ending actions, with the exception of the regular end.

7.5.4. Acting on multiple entities - bulk action

Private actions may have to control more than one entity at a time. This occurs when the actors resolve to multiple instances of an entity or an entity selection, in a maneuver group. In this case, all concerned instances of an Entity shall be actuated simultaneously when the action starts. An action that acts on multiple entities is called a Bulk Action. For more details on the behavior of Bulk Actions in runtime, see Section 8.3.3.3.

Actions acting on entity selections shall only be considered complete if all instances of entity in the selection have completed the tasks specified in the action. For example, an instance of a SpeedAction acting on five instances of Entity is only complete when all five instances of Entity have reached the desired speed, regardless of the fact that some of them may reach that speed earlier than others.

If any of the corresponding instances of Entity sparks a conflict with a newly started action, then the running action is overridden. All its instances of Entity are supposed to fall back to default behavior simultaneously. For example, and instance of a SpeedAction, A, controls five entities when an instance of a SpeedAction, B, starts, aiming to control one entity in action A. Because the actions are of the same nature, a conflict occurs and action A is overridden. Action B resumes control of the conflicting entity while the remaining entities from the late action A, engage in default behavior.

7.6. Conditions and triggers

A scenario can be regarded as a collection of meaningful actions whose activation is regulated by triggers. These triggers play an important role on how a scenario evolves because the same set of actions may lead to a multitude of different outcomes. The outcome strongly depends on how actions are triggered in relation to one other. In ASAM OpenSCENARIO, a trigger is the outcome arising from a combination of conditions and always evaluates to either true or false.

In ASAM OpenSCENARIO, a condition is a container for logical expressions and is assessed at runtime. The condition operates on the current and previous evaluations of its logical expressions to produce a Boolean output that is used by triggers.

7.6.1. Triggers and condition groups

The Trigger class is an association of ConditionGroup instances, which are an association of Condition instances. At runtime, a condition group evaluates to either true or false and its outcome is calculated as the AND operation between all its conditions:

A conditionGroup is evaluated to true when all its associated conditions are evaluated to true.

The outcome of a trigger is calculated as the OR operation between all its condition groups.

A trigger evaluates to true when at least one of its condition groups evaluates to true.

Formally, a trigger containing N instances of ConditionGroup at time td is defined as:

\[T(t_{d}) = \bigvee_{n=1}^{N} ConditionGroup_{n}(t_{d})\]

Let Mn be the number of conditions in a condition group m, and Conditionnm be condition n of condition group m. Replacing the condition group formulation in the expression above gives the trigger as:

\[T(t_{d}) = \bigvee_{n=1}^{N} \left ( \bigwedge_{m=1}^{M_{n}} Condition_{nm}(t_{d}) \right )\]
ASAM OpenSCENARIO v1.0 allows instances of the Trigger class to be empty, for example, no condition groups defined. Empty triggers are not meaningful and are kept for the sake of downward compatibility. This is expected to be addressed in the next major version where a trigger shall be defined with at least one condition group. An empty trigger is always evaluated to false.

Example

A trigger is formed by three condition groups. Let Mn be the number of conditions in condition Group n. The first condition group has two associated conditions (M1 = 2), the second condition group has three associated conditions (M2 = 3) and the third condition group has one associated condition (M3 = 1).

The trigger value is T(td) and is calculated as a function of its conditions' evaluations. Let CEmn be the evaluation of condition n of condition group m:

\[T(t_{d}) = ((C_{11}(t_{d}) \wedge C_{12}(t_{d})) \vee (C_{21}(t_{d}) \wedge C_{22}(t_{d}) \wedge C_{23}(t_{d})) \vee (C_{31}(t_{d})))\]
Start trigger

An instance of the Trigger class instantiated as a start trigger is used to move a runtime instantiation of a Storyboard element from the standbyState to the runningState. Only the Act class and Event class host start triggers and any element that does not contain a start trigger inherits the start trigger from its parent element. For example, starting an act also starts its maneuver groups and maneuvers, but does not start the events because the events have their own start triggers. Furthermore, no events may start if they do not belong to an act that is in the runningState.

The Story class is an exception to the rules above since it does not require a formal start trigger given that starting a simulation is equivalent to starting the Story.

Stop trigger

A stop trigger is used to force a runtime instantiation of a StoryboardElement to transition from its standbyState or runningState to the completeState. Only the storyboard and the act host stop triggers. All storyboard elements inherit the stop triggers from their parent. This is true even if the storyboard element under consideration has its own stop triggers. For example, if a story is affected by a stop trigger, so are all its acts, even though they have their own stop triggers.

When a stop trigger is received, the concerned storyboard element is expected to transition to the completeState with a stopTransition, and clear all remaining number of executions, if applicable. If the trigger occurs when the element is in the runningState, it is expected that its execution is terminated immediately.

7.6.2. Condition edges

When edges are defined, with rising, falling, and risingOrFalling, the condition evaluation is also dependent on past values of its logical expression at the discrete time td-1. See Figure 30 for the possible evaluations of a condition, given the available edges.

image
Figure 30. Evaluation of a speed condition with a greaterThan rule, for all possible edge values
Rising edges

When conditions have rising edges defined (conditionEdge = rising), the condition evaluation at discrete time td is true when its logical expressions at td evaluates to true and the logical expression at td-1 was evaluated to false:

\[C_{R}(t_{d}) = LogicalExpression(t_{d}) \wedge \overline{LogicalExpression(t_{d-1})}\]
Falling edges

In opposite to a rising edge, a falling edge condition (conditionEdge="falling") evaluates to true when its logical expression at td evaluates to false and the logical expression at td-1 evaluates to true:

\[C_{F}(t_{d}) = \overline{LogicalExpression(t_{d})} \wedge LogicalExpression(t_{d-1})\]
Rising or falling edges

When a condition was defined with rising or falling edges (conditionEdge="risingOrFalling"), the condition evaluation is simply a combination of rising or falling edges:

\[C_{RoF}(t_{d}) = C_{R}(t_{d}) \vee C_{F}(t_{d})\]
None edges

With none edges defined (conditionEdge="none"), the evaluation of a condition is the evaluation of its logical expression:

\[C_{N}(t_{d}) = LogicalExpression(t_{d})\]

7.6.3. Condition delay

A delay is a modification of a condition that allows past values of the condition evaluation to be used in the present td. When a delay Δt is defined, a condition at time td is represented by the evaluation of the logical expressions associated to that condition, at td-Δt, rather than the evaluation of its logical expressions at time td. In other words, evaluation of a delayed condition at time td it is equivalent to the evaluation of a similar condition, but without delay, at time td-Δt:

\[C_{D}(t_{d}) = C(t_{d-\Delta})\]

7.6.4. Corner cases of edges and delays

Both edge and delay concepts rely on previous evaluations of the logical expression of a condition. Depending on when the condition is evaluated, these previous evaluations of the logical expression may not be available.

The first time a condition defined with edge is checked, there is no information about previous evaluations of its logical expression. At runtime, a condition defined with edge shall always evaluate to false, the first time it is checked. ASAM OpenSCENARIO expects a condition to be checked for the first time once its enclosing storyboard element enters the standbyState. If standbyState is not defined, runningState shall be used.

In case of conditions defined with delay, if td < Δt, the concerned condition evaluates to false.

7.6.5. Condition types

The base condition type contains three basic elements: name, delay, and conditionEdge. Whereas the first element is self-explanatory, clarification on the other terms is given in the preceding sections. Other elements of a condition depend on its subtype, of which there are two: ByEntityCondition and ByValueCondition.

ByEntityConditions

The ByEntityCondition class hosts classes of conditions which use the states entities to perform the conditional evaluation. The conditional evaluation may depend on the value of a single state, or on how the value of any one given state relates to another state. The other state may be:

  • within the entity

  • between entities

  • between the entity and the corresponding characteristics of the road network

Entity conditions require the definition of triggering entities whose states are used in the conditional evaluation. If more than one triggering entity is defined, the user is given two alternatives to determine when the condition evaluates to true: either all triggering entities verify the logical expression or at least one entity verifies the logical expression.

ByValueConditions

The ByValueCondition classes hosts condition classes with logical expressions that depend on simulation states rather than entity states. Examples are scenario states, times, and traffic signal information.

Value conditions also provide a wrapper for external conditions that may depend on values that are not accessible from the scenario and are only available to the user implementation. Examples are pressing buttons, custom signals, and commands.

8. Scenario at runtime

This section covers the expected runtime behavior of the Storyboard and its nested elements in a simulation.

8.1. States

The lifecycle of a StoryboardElement instance includes five states.

initState and endState are implementation-specific and represent the creation (initState) and the cleanup (endState) of a StoryboardElement. All other states may be monitored with a StoryboardElementStateCondition.

  • standbyState: During the standbyState, a StoryboardElement waits for a start trigger. Only elements that define a start trigger or inherit a start trigger define a standbyState.

  • runningState: Represents the ongoing, unfinished execution of the StoryboardElement.

  • completeState: With transition into completeState, a StoryboardElement has reached its goal or was stopped.

8.2. Transitions

The change from one state to another is called transition. There are six transitions for the StoryboardElement lifecycle.

startElementLifecycle and stopElementLifecycle are implementation-specific and represent the creation (startElementLifecycle) and the cleanup (stopElementLifecycle) of a StoryboardElement. All other states may be monitored with StoryboardElementStateCondition.

  • startTransition: The transition into runningState. Either from standbyState, when waiting for a start trigger, or from initState, when a StoryboardElement enters runningState instantly because its parent enters runningState.

  • endTransition: The transition out of runningState. It symbolizes that runningState has ended regularly without being stopped.

  • stopTransition: The transition out of runningState or out of standbyState. It signals that the execution of the StoryboardElementelement was stopped, for example by overriding or an issued stop trigger.

  • skipTransition: This transition is specific to Event. skipTransition is used when an Event cannot be started due to its priority skip. See Section 8.4.2.

8.3. Execution

A storyboard element is defined as executing when the element either resides in standbyState or in runningState.

When a storyboard element enters runningState, its direct child elements are set into:

  • standbyState if the child element defines a start trigger.

  • runningState in all other cases.

8.3.1. Duration of an execution

The duration of an execution is determined by three factors:

  • Waiting time for start triggers.

  • Execution time for nested Action instances.

  • Waiting for Storyboards stop trigger when all Story instances have been completed.

There is no other runtime aspect that consumes simulation time.

8.3.2. Execution framework

The execution of a scenario follows a general nested pattern:

  • A Storyboard is executed by running its nested Story instances (0..*).

  • A Story is executed by running its nested Act instances (1..*)

  • An Act is executed by running its nested ManeuverGroup instances (1..*). Each ManeuverGroup is executed as often as defined in its maximumExecutionCount.

  • A ManeuverGroup is executed by running its nested Maneuver instances (0..*)

  • A Maneuver is executed by running its nested Event instances (1..*), following defined priorities. Each nested Event is executed as often as defined in its maximumExecutionCount.

  • An Event is executed by running its nested Action instances (1..*).

  • An Action in a Storyboard is executed by applying the designated behavior to any actor defined in the ManeuverGroup.

8.3.3. Execution patterns

ASAM OpenSCENARIO applies several execution patterns while running the Storyboard:

  • Parallel execution: Nested StoryboardElement instances are usually executed in parallel, for example, multiple Act instances in a Story.

  • Loop execution: Event instances and ManeuverGroup instances are executed in a loop. maximumExecutionCount states the number of executions.

  • Priority based execution: Event instances are executed based on a defined priority. See Section 8.4.2 for details.

  • Bulk action execution: Action instances in a Storyboard are executed by applying the defined behavior to any defined actor concurrently.

Parallel execution

When nested StoryboardElement instances are executed, the parent element forks into different execution paths. The parent execution completes when all execution paths have joined into a single path. Execution time of the parent element is defined by the nested element that takes the longest time to execute, as shown in Figure 31.

As an example, an Event completes when all concurrently executed Action instances are completed. The Action instance that took the longest time to execute defines the execution of the enclosing Event instance.

The execution of a Storyboard does not complete when all nested stories have been completed. See Section 8.4.7 for more information.
When referencing parallel actions and making them dependent of each other, the creation of deadlocks or nondeterministic race conditions shall be avoided.
image
Figure 31. Petrinet model shows the parallel execution pattern with three nested elements
Loop execution

ManeuverGroup and Event instances are executed as many times as specified by maximumExecutionCount. The executions are performed sequentially. Figure 32 illustrates how a ManueverGroup or an Event are executed when maximumExecutionCount is set to three:

image
Figure 32. Petrinet model that shows the loop execution pattern with three executions per element

Figure 33 shows a general representation of the same behavior:

image
Figure 33. Petrinet model that shows a general loop execution pattern
Bulk action execution

A bulk action is a PrivateAction that must handle more than one entities at the time. This can occur when the actors of the enclosing ManeuverGroup are resolved to multiple ScenarioObject instances, rather than to a single one. Executing a bulk action is called a bulk execution. It applies the PrivateAction in parallel to all given ScenarioObject instances. Figure 34 shows how a bulk action is ran. It completes when all its child actions complete. The behavior is applied to multiple actors, that is ScenarioObject instances, in parallel.

A bulk action is in runningState as long as there is one child action instance in runningState. It reaches completeState with endTransition only under the condition that all child actions reach completeState with an endTransition. Otherwise the bulk action reaches completeState with stopTransition.

image
Figure 34. Petrinet model that shows a bulk execution of an action

8.4. Storyboard element execution

8.4.1. Execution of a action

An Action instance enters runningState when the parent Event enters runningState. An Action transfers into completeState either when its execution is stopped or when it ends regularly, as shown in Figure 35. stopTransition may be used for different reasons.

image
Figure 35. State diagram for an action

8.4.2. Execution of an event

An Event enters standbyState when its enclosing Maneuver is started and enters runningState, as shown in Figure 36. When the start trigger of the Event is executed and the priority allows execution, the Event enters runningState. An Event lacking an own start trigger inherits its start trigger from its parent Act.

While in runningState, the Event ends regularly when every nested Action is completed. The Event transfers to completeState with stopTransition under two conditions:

  • A stop trigger is issued by the enclosing Act or Storyboard.

  • It is overridden by another Event in the same scope (Maneuver).

image
Figure 36. State diagram for an event
Execution count

The number of executions of an Event is represented as the sum of the number of startTransitions and skipTransitions.

When the Event is about to transfer out of runningState with endTransition, two things may happen:

  • The Event transfers to completeState if the number of executions is equal to maximumExecutionCount .

  • The Event transfers to standbyState if the number of executions is lower than the defined maximumExecutionCount.

If in standbyState and the number of executions is equal to the number stated by maximumExecutionCount, the Event transfers to completeState with skipTransition.

Event priority
  • Override: A triggered Event with priority override terminates any running Event in the same scope (Maneuver), when it moves to runningState. A terminated Event moves to completeState with stopTransition, regardless of the number of executions left.

  • Skip: A triggered Event with priority skip does not move to runningState and instead moves to completeState if no number of executions is defined, or there is an execution left. If there are execution left, the Event increases the number of executions by one.

  • Parallel: A triggered Event with priority parallel moves to the runningState regardless of the states of other Event instances in the same scope (Maneuver).

8.4.3. Execution of a maneuver

A Maneuver enters runningState as soon as its enclosing ManeuverGroup is started. In this state, all nested Event instances are set to standbyState and wait for their start trigger, as shown in Figure 37.

The Maneuver completes when all nested Event instances have entered the completeState or when the Maneuver is stopped by an issued stop trigger from the enclosing Act or Storyboard.

image
Figure 37. State diagram for a maneuver

8.4.4. Execution of a ManeuverGroup

ManeuverGroup instances are set to runningState when the start trigger of their enclosing Act is executed and the Act enters runningState. At this point, the nested Maneuver instances are set to runningState.

A ManeuverGroup ends regularly when all its Maneuvers are completed.

The number of executions of a ManeuverGroup corresponds to the number of startTransitions performed from the standbyState to the runningState. The ManeuverGroup transfers out of the runningState depending on the number of executions:

  • If the number of executions is smaller than maximumExecutionCount the ManeuverGroup transfers from runningState into standbyState and waits until the start trigger is executed. The start trigger is inherited from the enclosing Act.

  • If the number of executions is equal to the maximumExecutionCount, the ManeuverGroup transfers from runningState into completeState.

When the ManeuverGroup resides either in runningState or in standbyState, it may be stopped by a stop trigger that is issued by its enclosing Act or its Storyboard. When stopped, the ManeuverGroup transfers to completeState regardless of the number of execution counts left.

ASAM OpenSCENARIO allows empty ManeuverGroup instances. Figure 38 clarifies that in this case, the ManeuverGroup ends instantly and directly transfers to completeState without being started.
image
Figure 38. State diagram for a maneuver group

8.4.5. Execution of an act

An Act is set into standbyState as soon as its enclosing Story is started. When the start trigger of the Act is executed, the Act enters runningState, as shown in Figure 39. The nested ManeuverGroup instances transfer to runningState.

The Act may be stopped by its stop trigger or by the stop trigger in the enclosing Storyboard and let the Act transfer to completeState.

The Act ends regularly and enters completeState when all nested ManeuverGroup instances are completed.

image
Figure 39. State diagram for an act

8.4.6. Execution of a story

A Story is started and set into runningState when its enclosing Storyboard starts and enters runningState. Its nested Act instances are set to standbyState and wait for their start triggers to execute, as shown in Figure 40.

The execution of a Story is stopped when the enclosing Storyboard issues a stop trigger. The execution transfers from runningState into completeState when all nested Acts are completed.

image
Figure 40. State diagram for an Story

8.4.7. Execution of a storyboard

The Storyboard enters runningState when the simulation starts, as shown in Figure 41. This marks the start of the simulation time. Nested Story instances are started and set into runningState. A Storyboard does not transfer to completeState when all its nested stories are complete. A Storyboard only transfers to completeState with a stopTransition when its stop trigger is executed.

A Storyboard instance is able to run without defined stories, for example, when it is empty.

image
Figure 41. State diagram for a storyboard

8.5. Init section execution

The init section of a scenario defines actions to set entity states or global states providing initialization to a simulation. These actions are handled in the init phase prior to the execution of the StoryboardElement instances.

The order of the actions in the InitActions section is not translated into an execution order at runtime. All actions in init shall run concurrently and conflicts shall be handled according to the conflict solving guidelines provided in Section 7.5.1.

8.5.1. Running actions in the init phase

The actions defined in init are handled prior to the execution of the Storyboard. Because the simulation time starts with the execution of the Storyboard (see Section 8.4.7), the init phase does not consume simulation time. All types of Action may be used in init, even those that require elapsed simulation time to fulfill their designated goal, meaning that they cannot be executed instantaneously.

Handling of instantaneous actions

During the init phase, those actions that may be applied instantaneously are instantiated, executed, and reach the completeState, as shown in Figure 42.

image
Figure 42. State machine evolution for instantaneous actions during the init phase
Handling of non-instantaneous actions

During the init phase, those actions that require elapsed time to fulfill their goals, for example, instances of non-instantaneous actions, are instantiated and moved to runningState, as shown in Figure 43. These actions are left in runningState and are applied once the simulation starts with the execution of the storyboard. During storyboard execution, they shall be treated like any other actions that is instantiated during event execution. They may create conflicts with any newly created action and may be overridden by such an action.