Module Prediction

The CommonRoad XML-specification provides three possibilities to describe the movement of dynamic obstacles over time: known behavior, unknown behavior bounded by sets, and unknown behavior described by probability distributions. Known behaviour and unknown behavior bounded by sets are described by the class TrajectoryPrediction and SetBasedPrediction. Unknown behavior described by probability distributions is not supported in version 2019.1 and will be added in a future release.

Inheritance diagram of SetBasedPrediction, TrajectoryPrediction

Prediction class

class commonroad.prediction.prediction.Prediction(initial_time_step, occupancy_set)[source]

Base class for a prediction module.

initial_time_step

Initial time step of the prediction.

Return type:int
occupancy_at_time_step(time_step)[source]

Occupancy at a specific time step.

Parameters:time_step (int) – discrete time step
Return type:Union[None, Occupancy]
Returns:occupancy at time_step if time_step is within the time interval of the prediction; otherwise, None
occupancy_set

List of occupancies over time.

Return type:List[Occupancy]

TrajectoryPrediction class

class commonroad.prediction.prediction.TrajectoryPrediction(trajectory, shape)[source]

Class to represent the predicted movement of an obstacle using a trajectory. A trajectory is modeled as a state sequence over time. The occupancy of an obstacle along a trajectory is uniquely defined given its shape.

initial_time_step

Initial time step of the prediction.

Return type:int
occupancy_at_time_step(time_step)

Occupancy at a specific time step.

Parameters:time_step (int) – discrete time step
Return type:Union[None, Occupancy]
Returns:occupancy at time_step if time_step is within the time interval of the prediction; otherwise, None
occupancy_set

List of occupancies over time.

Return type:List[Occupancy]
shape

Shape of the predicted object.

Return type:Shape
trajectory

Predicted trajectory of the object.

Return type:Trajectory
translate_rotate(translation, angle)[source]

Translates and rotates all states of the trajectory and re-computes the translated and rotated occupancy set.

Parameters:
  • translation (ndarray) – translation vector [x_off, y_off] in x- and y-direction
  • angle (float) – rotation angle in radian (counter-clockwise)

SetBasedPrediction class

class commonroad.prediction.prediction.SetBasedPrediction(initial_time_step, occupancy_set)[source]

Class to represent the future behavior of obstacles by bounded occupancy sets.

initial_time_step

Initial time step of the prediction.

Return type:int
occupancy_at_time_step(time_step)

Occupancy at a specific time step.

Parameters:time_step (int) – discrete time step
Return type:Union[None, Occupancy]
Returns:occupancy at time_step if time_step is within the time interval of the prediction; otherwise, None
occupancy_set

List of occupancies over time.

Return type:List[Occupancy]
translate_rotate(translation, angle)[source]

Translates and rotates the occupancy set.

Parameters:
  • translation (ndarray) – translation vector [x_off, y_off] in x- and y-direction
  • angle (float) – rotation angle in radian (counter-clockwise)

Occupancy class

class commonroad.prediction.prediction.Occupancy(time_step, shape)[source]

Class describing an occupied area in the position domain. The occupied area can be defined for a certain time step or a time interval.

shape

Shape representing an occupied area in the position domain.

Return type:Shape
time_step

The occupied area is either defined for a certain time step or a time interval.

Return type:Union[int, Interval]
translate_rotate(translation, angle)[source]

Translates and rotates the occupied area.

Parameters:
  • translation (ndarray) – translation vector [x_off, y_off] in x- and y-direction
  • angle (float) – rotation angle in radian (counter-clockwise)