TimeInterpolatablePose2dBuffer

class wpimath.interpolation.TimeInterpolatablePose2dBuffer(*args, **kwargs)

Bases: pybind11_object

The TimeInterpolatableBuffer provides an easy way to estimate past measurements. One application might be in conjunction with the DifferentialDrivePoseEstimator, where knowledge of the robot pose at the time when vision or other global measurement were recorded is necessary, or for recording the past angles of mechanisms as measured by encoders.

When sampling this buffer, a user-provided function or wpi::Lerp can be used. For Pose2ds, we use Twists.

@tparam T The type stored in this buffer.

Overloaded function.

  1. __init__(self: wpimath.interpolation._interpolation.TimeInterpolatablePose2dBuffer, historySize: seconds, func: Callable[[wpimath.geometry._geometry.Pose2d, wpimath.geometry._geometry.Pose2d, float], wpimath.geometry._geometry.Pose2d]) -> None

Create a new TimeInterpolatableBuffer.

Parameters:
  • historySize – The history size of the buffer.

  • func – The function used to interpolate between values.

  1. __init__(self: wpimath.interpolation._interpolation.TimeInterpolatablePose2dBuffer, historySize: seconds) -> None

Create a new TimeInterpolatableBuffer. By default, the interpolation function is wpi::Lerp except for Pose2d, which uses the pose exponential.

Parameters:

historySize – The history size of the buffer.

addSample(time: seconds, sample: wpimath.geometry._geometry.Pose2d) None

Add a sample to the buffer.

Parameters:
  • time – The timestamp of the sample.

  • sample – The sample object.

clear() None

Clear all old samples.

getInternalBuffer() List[Tuple[seconds, wpimath.geometry._geometry.Pose2d]]

Grant access to the internal sample buffer. Used in Pose Estimation to replay odometry inputs stored within this buffer.

sample(time: seconds) wpimath.geometry._geometry.Pose2d | None

Sample the buffer at the given time. If the buffer is empty, an empty optional is returned.

Parameters:

time – The time at which to sample the buffer.