DifferentialTrajectory

class wpimath.DifferentialTrajectory(samples: collections.abc.Sequence[wpimath._wpimath.DifferentialSample])

Bases: DifferentialTrajectoryBase

A trajectory for differential drive robots with drivetrain-specific interpolation.

This trajectory uses numerical integration of the differential drive differential equation for accurate interpolation.

Constructs a DifferentialTrajectory 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.DifferentialTrajectory) wpimath._wpimath.DifferentialTrajectory

Concatenates another trajectory to this trajectory.

Parameters:

other – The trajectory to concatenate.

Returns:

The concatenated trajectory.

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

Interpolates between two samples using numerical integration of the differential drive differential equation.

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.DifferentialTrajectory

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.DifferentialTrajectory

Transforms all poses in the trajectory by the given transform.

Parameters:

transform – The transform to apply to the poses.

Returns:

The transformed trajectory.