Class HolonomicSample
java.lang.Object
org.wpilib.math.trajectory.TrajectorySample
org.wpilib.math.trajectory.HolonomicSample
- All Implemented Interfaces:
ProtobufSerializable, StructSerializable, WPISerializable
- Direct Known Subclasses:
DifferentialSample, DrivetrainSplineSample
public class HolonomicSample
extends TrajectorySample
implements StructSerializable, ProtobufSerializable
Represents a single sample in a trajectory.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe robot acceleration at this sample (in the field reference frame).The robot pose at this sample (in the field reference frame).static final HolonomicSampleProtoBase proto for serialization.static final HolonomicSampleStructBase struct for serialization.The robot velocity at this sample (in the field reference frame).Fields inherited from class TrajectorySample
time -
Constructor Summary
ConstructorsConstructorDescriptionHolonomicSample(double time, Pose2d pose, ChassisVelocities velocity, ChassisAccelerations acceleration) Constructs a HolonomicSample.HolonomicSample(Time time, Pose2d pose, ChassisVelocities velocity, ChassisAccelerations acceleration) Constructs a HolonomicSample. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()static HolonomicSamplekinematicInterpolate(HolonomicSample start, HolonomicSample end, double t) Interpolates between two samples using constant-acceleration kinematic equations.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.
-
Field Details
-
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). -
struct
Base struct for serialization. -
proto
Base proto for serialization.
-
-
Constructor Details
-
HolonomicSample
public HolonomicSample(double time, Pose2d pose, ChassisVelocities velocity, ChassisAccelerations acceleration) Constructs a HolonomicSample.- 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).
-
HolonomicSample
public HolonomicSample(Time time, Pose2d pose, ChassisVelocities velocity, ChassisAccelerations acceleration) Constructs a HolonomicSample.- 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).
-
-
Method Details
-
hashCode
public int hashCode()- Overrides:
hashCodein classTrajectorySample
-
equals
- Overrides:
equalsin classTrajectorySample
-
kinematicInterpolate
public static HolonomicSample kinematicInterpolate(HolonomicSample start, HolonomicSample end, double t) Interpolates between two samples using constant-acceleration kinematic equations.- Parameters:
start- The start sample.end- The end sample.t- The time between the start and end samples. Should be in the range [0, 1].- Returns:
- new sample.
-
transform
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.
-
relativeTo
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.
-