DifferentialSample

class wpimath.DifferentialSample(*args, **kwargs)

Bases: HolonomicSample

Represents a single sample in a differential drive trajectory.

Overloaded function.

  1. __init__(self: wpimath._wpimath.DifferentialSample) -> None

Constructs a default DifferentialSample with all zero values.

  1. __init__(self: wpimath._wpimath.DifferentialSample, time: wpimath.units.seconds, pose: wpimath._wpimath.Pose2d, velocity: wpimath._wpimath.ChassisVelocities, acceleration: wpimath._wpimath.ChassisAccelerations, left_velocity: wpimath.units.meters_per_second, right_velocity: wpimath.units.meters_per_second) -> None

Constructs a DifferentialSample.

Parameters:
  • time – The time of the sample relative to the trajectory start.

  • pose – The robot pose at this sample (in the field reference frame).

  • velocity – The robot velocity at this sample (in the field reference frame).

  • acceleration – The robot acceleration at this sample (in the field reference frame).

  • left_velocity – The left wheel velocity at this sample.

  • right_velocity – The right wheel velocity at this sample.

  1. __init__(self: wpimath._wpimath.DifferentialSample, time: wpimath.units.seconds, pose: wpimath._wpimath.Pose2d, velocity: wpimath._wpimath.ChassisVelocities, acceleration: wpimath._wpimath.ChassisAccelerations, kinematics: wpimath._wpimath.DifferentialDriveKinematics) -> None

Constructs a DifferentialSample.

Parameters:
  • time – The time of the sample relative to the trajectory start.

  • pose – The robot pose at this sample (in the field reference frame).

  • velocity – The robot velocity at this sample (in the field reference frame).

  • acceleration – The robot acceleration at this sample (in the field reference frame).

  • kinematics – The kinematics of the drivetrain.

  1. __init__(self: wpimath._wpimath.DifferentialSample, sample: wpimath._wpimath.HolonomicSample, left_velocity: wpimath.units.meters_per_second, right_velocity: wpimath.units.meters_per_second) -> None

Constructs a DifferentialSample from a TrajectorySample.

Parameters:
  • sample – The TrajectorySample to copy.

  • left_velocity – The left wheel velocity at this sample.

  • right_velocity – The right wheel velocity at this sample.

  1. __init__(self: wpimath._wpimath.DifferentialSample, sample: wpimath._wpimath.HolonomicSample, kinematics: wpimath._wpimath.DifferentialDriveKinematics) -> None

Constructs a DifferentialSample from a TrajectorySample.

Parameters:
  • sample – The TrajectorySample to copy.

  • kinematics – The kinematics of the drivetrain.

  1. __init__(self: wpimath._wpimath.DifferentialSample, sample: wpimath._wpimath.DrivetrainSplineSample, kinematics: wpimath._wpimath.DifferentialDriveKinematics) -> None

Constructs a DifferentialSample from a SplineSample.

Parameters:
  • sample – The SplineSample to copy.

  • kinematics – The kinematics of the drivetrain.

relative_to(other: wpimath._wpimath.Pose2d) wpimath._wpimath.DifferentialSample

Transforms this sample to be relative to the given pose.

Parameters:

other – The pose to make this sample relative to.

Returns:

A new sample with the relative pose.

transform(transform: wpimath._wpimath.Transform2d) wpimath._wpimath.DifferentialSample

Transforms the pose of this sample by the given transform.

Parameters:

transform – The transform to apply to the pose.

Returns:

A new sample with the transformed pose.