TrajectoryGenerator

class wpimath.TrajectoryGenerator

Bases: pybind11_object

Helper class used to generate spline-based trajectories with various constraints.

static generate_trajectory(*args, **kwargs)

Overloaded function.

  1. generate_trajectory(initial: wpimath._wpimath.Spline3.ControlVector, interior_waypoints: collections.abc.Sequence[wpimath._wpimath.Translation2d], end: wpimath._wpimath.Spline3.ControlVector, config: wpimath._wpimath.TrajectoryConfig) -> wpimath._wpimath.DrivetrainSplineTrajectory

Generates a spline trajectory from the given control vectors and config. This method uses clamped cubic splines – a method in which the exterior control vectors and interior waypoints are provided. The headings are automatically determined at the interior points to ensure continuous curvature.

Parameters:
  • initial – The initial control vector.

  • interior_waypoints – The interior waypoints.

  • end – The ending control vector.

  • config – The configuration for the trajectory.

Returns:

The generated spline trajectory.

  1. generate_trajectory(start: wpimath._wpimath.Pose2d, interior_waypoints: collections.abc.Sequence[wpimath._wpimath.Translation2d], end: wpimath._wpimath.Pose2d, config: wpimath._wpimath.TrajectoryConfig) -> wpimath._wpimath.DrivetrainSplineTrajectory

Generates a spline trajectory from the given waypoints and config. This method uses clamped cubic splines – a method in which the initial pose, final pose, and interior waypoints are provided. The headings are automatically determined at the interior points to ensure continuous curvature.

Parameters:
  • start – The starting pose.

  • interior_waypoints – The interior waypoints.

  • end – The ending pose.

  • config – The configuration for the trajectory.

Returns:

The generated spline trajectory.

  1. generate_trajectory(control_vectors: collections.abc.Sequence[wpimath._wpimath.Spline5.ControlVector], config: wpimath._wpimath.TrajectoryConfig) -> wpimath._wpimath.DrivetrainSplineTrajectory

Generates a spline trajectory from the given quintic control vectors and config. This method uses quintic hermite splines – therefore, all points must be represented by control vectors. Continuous curvature is guaranteed in this method.

Parameters:
  • control_vectors – List of quintic control vectors.

  • config – The configuration for the trajectory.

Returns:

The generated spline trajectory.

  1. generate_trajectory(waypoints: collections.abc.Sequence[wpimath._wpimath.Pose2d], config: wpimath._wpimath.TrajectoryConfig) -> wpimath._wpimath.DrivetrainSplineTrajectory

Generates a spline trajectory from the given waypoints and config. This method uses quintic hermite splines – therefore, all points must be represented by Pose2d objects. Continuous curvature is guaranteed in this method.

Parameters:
  • waypoints – List of waypoints..

  • config – The configuration for the trajectory.

Returns:

The generated spline trajectory.

static set_error_handler(func: collections.abc.Callable[[str], None]) None

Set error reporting function. By default, it is output to stderr.

Parameters:

func – Error reporting function.

static spline_points_from_splines(*args, **kwargs)

Overloaded function.

  1. spline_points_from_splines(splines: collections.abc.Sequence[wpimath._wpimath.CubicHermiteSpline]) -> list[tuple[wpimath._wpimath.Pose2d, wpimath.units.radians_per_meter]]

Generate spline points from a vector of splines by parameterizing the splines.

Parameters:

splines – The splines to parameterize.

Returns:

The spline points for use in time parameterization of a trajectory.

  1. spline_points_from_splines(splines: collections.abc.Sequence[wpimath._wpimath.QuinticHermiteSpline]) -> list[tuple[wpimath._wpimath.Pose2d, wpimath.units.radians_per_meter]]

Generate spline points from a vector of splines by parameterizing the splines.

Parameters:

splines – The splines to parameterize.

Returns:

The spline points for use in time parameterization of a trajectory.