waymax.metrics.route#

Metrics relating to route.

Module Contents#

Classes#

ProgressionMetric

Route progression metric for SDC.

OffRouteMetric

Off-route metric for the SDC.

Attributes#

waymax.metrics.route.FULL_PROGRESS_VALUE = 1.0#
class waymax.metrics.route.ProgressionMetric#

Bases: waymax.metrics.abstract_metric.AbstractMetric

Route progression metric for SDC.

This metric returns a non-negative value representing the progression towards the final logged position from the initial logged position along the route. It first finds the closest on-route path to the SDC’s current xy position according to Euclidean distance and uses that as the reference path to compute the progress (arc_length) relative to the logged SDC’s initial and final xy positions.

If the SDC trajectory is invalid or there are no valid on-route paths, it returns zero.

compute(simulator_state: waymax.datatypes.SimulatorState) waymax.metrics.abstract_metric.MetricResult#

Computes the progression metric.

Parameters:

simulator_state – The current simulator state of shape.

Returns:

A (…) MetricResult containing the metric result described above.

Raises:

ValueError – If simulator_state.sdc_paths is undefined.

class waymax.metrics.route.OffRouteMetric#

Bases: waymax.metrics.abstract_metric.AbstractMetric

Off-route metric for the SDC.

The SDC is considered off-route either if 1) it is farther than MAX_DISTANCE_TO_ROUTE_PATH from the closest on-route path, or 2) it is farther from the closest on-route path than the closest off-route path by MAX_RELATIVE_DISTANCE_TO_OFF_ROUTE_PATH.

If the SDC is on-route, the SDC trajectory is completely invalid, or there are no valid on-route paths, it returns zero.

If the SDC is off-route, this metric returns the distance to the closest valid on-route path. If there are no valid on-route paths, it returns the distance to the closest valid off-route path.

MAX_DISTANCE_TO_ROUTE_PATH = 5#
MAX_RELATIVE_DISTANCE_TO_OFF_ROUTE_PATH = 2#
compute(simulator_state: waymax.datatypes.SimulatorState) waymax.metrics.abstract_metric.MetricResult#

Computes the off route metric.

Parameters:

simulator_state – The current simulator state of shape (….).

Returns:

A (…) MetricResult containing the metric result described above.

Raises:

ValueError – If simulator_state.sdc_paths is undefined.