DifferentialSample
- class wpimath.DifferentialSample(*args, **kwargs)
Bases:
TrajectorySampleRepresents a single sample in a differential drive trajectory.
Overloaded function.
__init__(self: wpimath._wpimath.DifferentialSample) -> None
Constructs a default DifferentialSample with all zero values.
__init__(self: wpimath._wpimath.DifferentialSample, timestamp: wpimath.units.seconds, pose: wpimath._wpimath.Pose2d, velocity: wpimath._wpimath.ChassisVelocities, acceleration: wpimath._wpimath.ChassisAccelerations, left_speed: wpimath.units.meters_per_second, right_speed: wpimath.units.meters_per_second) -> None
Constructs a DifferentialSample.
- Parameters:
timestamp – The timestamp 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_speed – The left wheel speed at this sample.
right_speed – The right wheel speed at this sample.
__init__(self: wpimath._wpimath.DifferentialSample, timestamp: wpimath.units.seconds, pose: wpimath._wpimath.Pose2d, velocity: wpimath._wpimath.ChassisVelocities, acceleration: wpimath._wpimath.ChassisAccelerations, kinematics: wpimath._wpimath.DifferentialDriveKinematics) -> None
Constructs a DifferentialSample.
- Parameters:
timestamp – The timestamp 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.
__init__(self: wpimath._wpimath.DifferentialSample, sample: wpimath._wpimath.TrajectorySample, left_speed: wpimath.units.meters_per_second, right_speed: wpimath.units.meters_per_second) -> None
Constructs a DifferentialSample from a TrajectorySample.
- Parameters:
sample – The TrajectorySample to copy.
left_speed – The left wheel speed at this sample.
right_speed – The right wheel speed at this sample.
__init__(self: wpimath._wpimath.DifferentialSample, sample: wpimath._wpimath.TrajectorySample, kinematics: wpimath._wpimath.DifferentialDriveKinematics) -> None
Constructs a DifferentialSample from a TrajectorySample.
- Parameters:
sample – The TrajectorySample to copy.
kinematics – The kinematics of the drivetrain.
__init__(self: wpimath._wpimath.DifferentialSample, sample: wpimath._wpimath.SplineSample, 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.
- with_new_timestamp(new_timestamp: wpimath.units.seconds) wpimath._wpimath.DifferentialSample
Creates a new sample with the given timestamp.
- Parameters:
new_timestamp – The new timestamp.
- Returns:
A new sample with the given timestamp.