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).

6.4.7.1 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.

6.4.7.2 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

6.4.8.1 Longitudinal distance

6.4.8.1.1 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, “Helping route”).

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.

6.4.8.1.2 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.

6.4.8.1.3 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.

6.4.8.2 Lateral distance

6.4.8.2.1 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.

6.4.8.2.2 Lane coordinate system

The lateral distance is undefined.

6.4.8.2.3 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.

6.4.8.3 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.