Class Trajectory

  • public class Trajectory
    extends Object
    Represents a time-parameterized trajectory. The trajectory contains of various States that represent the pose, curvature, time elapsed, velocity, and acceleration at that point.
    • Constructor Detail

      • Trajectory

        public Trajectory​(List<Trajectory.State> states)
        Constructs a trajectory from a vector of states.
        states - A vector of states.
    • Method Detail

      • getInitialPose

        public Pose2d getInitialPose()
        Returns the initial pose of the trajectory.
        The initial pose of the trajectory.
      • getTotalTimeSeconds

        public double getTotalTimeSeconds()
        Returns the overall duration of the trajectory.
        The duration of the trajectory.
      • getStates

        public List<Trajectory.State> getStates()
        Return the states of the trajectory.
        The states of the trajectory.
      • sample

        public Trajectory.State sample​(double timeSeconds)
        Sample the trajectory at a point in time.
        timeSeconds - The point in time since the beginning of the trajectory to sample.
        The state at that point in time.
      • transformBy

        public Trajectory transformBy​(Transform2d transform)
        Transforms all poses in the trajectory by the given transform. This is useful for converting a robot-relative trajectory into a field-relative trajectory. This works with respect to the first pose in the trajectory.
        transform - The transform to transform the trajectory by.
        The transformed trajectory.
      • relativeTo

        public Trajectory relativeTo​(Pose2d pose)
        Transforms all poses in the trajectory so that they are relative to the given pose. This is useful for converting a field-relative trajectory into a robot-relative trajectory.
        pose - The pose that is the origin of the coordinate frame that the current trajectory will be transformed into.
        The transformed trajectory.