Class DifferentialSample
java.lang.Object
org.wpilib.math.trajectory.TrajectorySample
org.wpilib.math.trajectory.HolonomicSample
org.wpilib.math.trajectory.DifferentialSample
- All Implemented Interfaces:
ProtobufSerializable, StructSerializable, WPISerializable
Represents a single sample in a differential drive trajectory.
-
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleThe left-wheel velocity at this sample in meters per second.static final DifferentialSampleProtoBase proto for serialization.doubleThe right-wheel velocity at this sample in meters per second.static final DifferentialSampleStructBase struct for serialization.Fields inherited from class HolonomicSample
acceleration, pose, velocityFields inherited from class TrajectorySample
time -
Constructor Summary
ConstructorsConstructorDescriptionDifferentialSample(double time, Pose2d pose, ChassisVelocities velocity, ChassisAccelerations acceleration, double leftVelocity, double rightVelocity) Constructs a DifferentialSample.DifferentialSample(double time, Pose2d pose, ChassisVelocities velocity, ChassisAccelerations acceleration, DifferentialDriveKinematics kinematics) Constructs a DifferentialSample.DifferentialSample(HolonomicSample sample, double leftVelocity, double rightVelocity) Constructs a DifferentialSample from a HolonomicSample.DifferentialSample(HolonomicSample sample, DifferentialDriveKinematics kinematics) Constructs a DifferentialSample from a HolonomicSample.DifferentialSample(Time time, Pose2d pose, ChassisVelocities velocity, ChassisAccelerations acceleration, LinearVelocity leftVelocity, LinearVelocity rightVelocity) Constructs a DifferentialSample. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()relativeTo(Pose2d other) Transforms this sample to be relative to the given pose.transform(Transform2d transform) Transforms the pose of this sample by the given transform.Methods inherited from class HolonomicSample
kinematicInterpolate
-
Field Details
-
leftVelocity
public double leftVelocityThe left-wheel velocity at this sample in meters per second. -
rightVelocity
public double rightVelocityThe right-wheel velocity at this sample in meters per second. -
proto
Base proto for serialization. -
struct
Base struct for serialization.
-
-
Constructor Details
-
DifferentialSample
public DifferentialSample(double time, Pose2d pose, ChassisVelocities velocity, ChassisAccelerations acceleration, double leftVelocity, double rightVelocity) Constructs a DifferentialSample.- Parameters:
time- The time of the sample relative to the trajectory start, in seconds.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).leftVelocity- The left-wheel velocity at this sample in meters per second.rightVelocity- The right-wheel velocity at this sample in meters per second.
-
DifferentialSample
public DifferentialSample(Time time, Pose2d pose, ChassisVelocities velocity, ChassisAccelerations acceleration, LinearVelocity leftVelocity, LinearVelocity rightVelocity) 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).leftVelocity- The left wheel velocity at this sample.rightVelocity- The right wheel velocity at this sample.
-
DifferentialSample
public DifferentialSample(double time, Pose2d pose, ChassisVelocities velocity, ChassisAccelerations acceleration, DifferentialDriveKinematics kinematics) Constructs a DifferentialSample.- Parameters:
time- The time of the sample relative to the trajectory start, in seconds.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.
-
DifferentialSample
Constructs a DifferentialSample from a HolonomicSample.- Parameters:
sample- The HolonomicSample to copy.leftVelocity- The left wheel velocity at this sample in meters per second.rightVelocity- The right wheel velocity at this sample in meters per second.
-
DifferentialSample
Constructs a DifferentialSample from a HolonomicSample.- Parameters:
sample- The HolonomicSample to copy.kinematics- The kinematics of the drivetrain.
-
-
Method Details
-
equals
- Overrides:
equalsin classHolonomicSample
-
hashCode
public int hashCode()- Overrides:
hashCodein classHolonomicSample
-
transform
Transforms the pose of this sample by the given transform.- Overrides:
transformin classHolonomicSample- Parameters:
transform- The transform to apply to the pose.- Returns:
- A new sample with the transformed pose.
-
relativeTo
Transforms this sample to be relative to the given pose.- Overrides:
relativeToin classHolonomicSample- Parameters:
other- The pose to make this sample relative to.- Returns:
- A new sample with the relative pose.
-