DrivetrainSplineTrajectory

class wpimath.DrivetrainSplineTrajectory(samples: collections.abc.Sequence[wpimath._wpimath.DrivetrainSplineSample])

Bases: DrivetrainSplineTrajectoryBase

A trajectory for spline-based path following.

This trajectory uses constant-acceleration kinematic equations for interpolation between samples.

Constructs a DrivetrainSplineTrajectory from a vector of samples.

Parameters:

samples – The samples of the trajectory. Order does not matter as they will be sorted internally. @throws std::invalid_argument if the vector of samples is empty.

concatenate(other: wpimath._wpimath.DrivetrainSplineTrajectory) wpimath._wpimath.DrivetrainSplineTrajectory

Concatenates another trajectory to this trajectory.

Parameters:

other – The trajectory to concatenate.

Returns:

The concatenated trajectory.

interpolate(start: wpimath._wpimath.DrivetrainSplineSample, end: wpimath._wpimath.DrivetrainSplineSample, t: SupportsFloat | SupportsIndex) wpimath._wpimath.DrivetrainSplineSample

Interpolates between two samples using constant-acceleration kinematic equations.

Parameters:
  • start – The starting sample.

  • end – The ending sample.

  • t – The interpolation parameter between 0 and 1.

Returns:

The interpolated sample.

relative_to(pose: wpimath._wpimath.Pose2d) wpimath._wpimath.DrivetrainSplineTrajectory

Transforms all poses so they are relative to the given pose.

Parameters:

pose – The pose to make the trajectory relative to.

Returns:

The transformed trajectory.

transform_by(transform: wpimath._wpimath.Transform2d) wpimath._wpimath.DrivetrainSplineTrajectory

Transforms all poses in the trajectory by the given transform.

Parameters:

transform – The transform to apply to the poses.

Returns:

The transformed trajectory.