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 Details

    • pose

      public Pose2d pose
      The robot pose at this sample (in the field reference frame).
    • velocity

      public ChassisVelocities velocity
      The robot velocity at this sample (in the field reference frame).
    • acceleration

      public ChassisAccelerations acceleration
      The robot acceleration at this sample (in the field reference frame).
    • struct

      public static final HolonomicSampleStruct struct
      Base struct for serialization.
    • proto

      public static final HolonomicSampleProto 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:
      hashCode in class TrajectorySample
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class TrajectorySample
    • 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

      public HolonomicSample transform(Transform2d 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

      public HolonomicSample relativeTo(Pose2d other)
      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.