Class ChoreoTrajectory

java.lang.Object
com.choreo.lib.ChoreoTrajectory

public class ChoreoTrajectory extends Object
A trajectory loaded from Choreo.
  • Constructor Details

    • ChoreoTrajectory

      public ChoreoTrajectory()
      Create an empty ChoreoTrajectory.
    • ChoreoTrajectory

      public ChoreoTrajectory(List<ChoreoTrajectoryState> samples)
      Constructs a new trajectory from a list of trajectory states
      Parameters:
      samples - a vector containing a list of ChoreoTrajectoryStates
  • Method Details

    • getInitialState

      public ChoreoTrajectoryState getInitialState()
      Returns the first ChoreoTrajectoryState in the trajectory.
      Returns:
      The first ChoreoTrajectoryState in the trajectory.
    • getFinalState

      public ChoreoTrajectoryState getFinalState()
      Returns the last ChoreoTrajectoryState in the trajectory.
      Returns:
      The last ChoreoTrajectoryState in the trajectory.
    • sample

      public ChoreoTrajectoryState sample(double timestamp)
      Return an interpolated, non-mirrored sample of the trajectory at the given timestamp.
      Parameters:
      timestamp - The timestamp of this sample relative to the beginning of the trajectory.
      Returns:
      The ChoreoTrajectoryState at the given time.
    • sample

      public ChoreoTrajectoryState sample(double timestamp, boolean mirrorForRedAlliance)
      Return an interpolated sample of the trajectory at the given timestamp.
      Parameters:
      timestamp - The timestamp of this sample relative to the beginning of the trajectory.
      mirrorForRedAlliance - whether or not to return the sample as mirrored across the field midline (as in 2023).
      Returns:
      The ChoreoTrajectoryState at the given time.
    • getSamples

      public List<ChoreoTrajectoryState> getSamples()
      Returns the list of states for this trajectory.
      Returns:
      this trajectory's states.
    • getInitialPose

      public Pose2d getInitialPose()
      Returns the initial, non-mirrored pose of the trajectory.
      Returns:
      the initial, non-mirrored pose of the trajectory.
    • getFlippedInitialPose

      public Pose2d getFlippedInitialPose()
      Returns the initial, mirrored pose of the trajectory.
      Returns:
      the initial, mirrored pose of the trajectory.
    • getFinalPose

      public Pose2d getFinalPose()
      Returns the final, non-mirrored pose of the trajectory.
      Returns:
      the final, non-mirrored pose of the trajectory.
    • getFlippedFinalPose

      public Pose2d getFlippedFinalPose()
      Returns the final, mirrored pose of the trajectory.
      Returns:
      the final, mirrored pose of the trajectory.
    • getTotalTime

      public double getTotalTime()
      Returns the total time of the trajectory (the timestamp of the last sample)
      Returns:
      the total time of the trajectory (the timestamp of the last sample)
    • getPoses

      public Pose2d[] getPoses()
      Returns the array of poses corresponding to the trajectory.
      Returns:
      the array of poses corresponding to the trajectory.
    • flipped

      public ChoreoTrajectory flipped()
      Returns this trajectory, mirrored across the field midline.
      Returns:
      this trajectory, mirrored across the field midline.