Package com.choreo.lib
Class ChoreoTrajectory
java.lang.Object
com.choreo.lib.ChoreoTrajectory
A trajectory loaded from Choreo.
-
Constructor Summary
ConstructorDescriptionCreate an empty ChoreoTrajectory.ChoreoTrajectory
(List<ChoreoTrajectoryState> samples) Constructs a new trajectory from a list of trajectory states -
Method Summary
Modifier and TypeMethodDescriptionflipped()
Returns this trajectory, mirrored across the field midline.Returns the final, non-mirrored pose of the trajectory.Returns the last ChoreoTrajectoryState in the trajectory.Returns the final, mirrored pose of the trajectory.Returns the initial, mirrored pose of the trajectory.Returns the initial, non-mirrored pose of the trajectory.Returns the first ChoreoTrajectoryState in the trajectory.Pose2d[]
getPoses()
Returns the array of poses corresponding to the trajectory.Returns the list of states for this trajectory.double
Returns the total time of the trajectory (the timestamp of the last sample)sample
(double timestamp) Return an interpolated, non-mirrored sample of the trajectory at the given timestamp.sample
(double timestamp, boolean mirrorForRedAlliance) Return an interpolated sample of the trajectory at the given timestamp.
-
Constructor Details
-
ChoreoTrajectory
public ChoreoTrajectory()Create an empty ChoreoTrajectory. -
ChoreoTrajectory
Constructs a new trajectory from a list of trajectory states- Parameters:
samples
- a vector containing a list of ChoreoTrajectoryStates
-
-
Method Details
-
getInitialState
Returns the first ChoreoTrajectoryState in the trajectory.- Returns:
- The first ChoreoTrajectoryState in the trajectory.
-
getFinalState
Returns the last ChoreoTrajectoryState in the trajectory.- Returns:
- The last ChoreoTrajectoryState in the trajectory.
-
sample
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
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
Returns the list of states for this trajectory.- Returns:
- this trajectory's states.
-
getInitialPose
Returns the initial, non-mirrored pose of the trajectory.- Returns:
- the initial, non-mirrored pose of the trajectory.
-
getFlippedInitialPose
Returns the initial, mirrored pose of the trajectory.- Returns:
- the initial, mirrored pose of the trajectory.
-
getFinalPose
Returns the final, non-mirrored pose of the trajectory.- Returns:
- the final, non-mirrored pose of the trajectory.
-
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
Returns the array of poses corresponding to the trajectory.- Returns:
- the array of poses corresponding to the trajectory.
-
flipped
Returns this trajectory, mirrored across the field midline.- Returns:
- this trajectory, mirrored across the field midline.
-