rtd.planner.trajectory.TrajectoryContainer

class rtd.planner.trajectory.TrajectoryContainer[source]

Bases: object

__init__()[source]

Methods

__init__()

clear()

Clears the container and resets it to the initial state It's expected that there's already some initial trajectory set.

getCommand(time)

Generates a command based on the time.

isValid([errorIfInvalid])

Checks if the container is valid.

setInitialTrajectory(initialTrajectory)

Sets the initial trajectory for the container.

setTrajectory(trajectory[, errorIfInvalid])

Sets a new trajectory for the container to the end.

clear()[source]

Clears the container and resets it to the initial state It’s expected that there’s already some initial trajectory set. If not, a warning is thrown.

getCommand(time: float | list[float]) list[rtd.entity.states.EntityState.EntityState][source]

Generates a command based on the time. The command is generated based on the trajectory that is active at the time. If the time is before the start of the first trajectory, then the command is generated based on the initial trajectory. If the time is after the last trajectory, then the command is generated based on the last trajectory.

Parameters:

time (float | list[float]) – the time(s) to generate the command for

Returns:

commands – the generated commands

Return type:

NDArray[EntityState]

isValid(errorIfInvalid: bool = False) bool[source]

Checks if the container is valid.

Parameters:

errorIfInvalid (bool) – whether to raise an error when the container is invalid

Returns:

valid – whether the container is valid or not

Return type:

bool

setInitialTrajectory(initialTrajectory: Trajectory)[source]

Sets the initial trajectory for the container. This method must be called before any other method is called.

Parameters:

initialTrajectory (Trajectory) – the initial trajectory to add

setTrajectory(trajectory: Trajectory, errorIfInvalid: bool = False)[source]

Sets a new trajectory for the container to the end. The new trajectory must start at a time greater than equal to the end of the last trajectory.

Parameters:
  • trajectory (Trajectory) – the trajectory to add

  • errorIfInvalid (bool) – whether to raise an error when the trajectory is invalid