Class Auto

All Implemented Interfaces:
Sendable

public class Auto extends SequentialCommandGroup
Base class for autonomous routines that load Choreo trajectories and expose common path utilities.
  • Field Details

  • Constructor Details

    • Auto

      public Auto()
      Creates a new autonomous routine container with a default name.
  • Method Details

    • loadTrajectory

      protected void loadTrajectory(String name)
      Registers a trajectory to be part of the auto. The actual trajectory will be loaded once the auto is selected, allowing for pre-caching of trajectories without loading them all at once during initialization.
      Parameters:
      name - The name of the trajectory to load
    • cacheTrajetories

      public void cacheTrajetories(boolean is_red_alliance)
      Loads all registered trajectories from Choreo and processes them for use in the auto. This should be called once after the auto is selected to ensure all paths are ready before execution
      Parameters:
      is_red_alliance - true if the robot is on the red alliance, false for blue (used for flipping trajectories)
    • getTrajectory

      protected Supplier<ChoreoTrajectory> getTrajectory(String name)
      Get a loaded trajectory by name.
      Parameters:
      name - The name of the trajectory
      Returns:
      The typed Choreo trajectory
      Throws:
      IllegalStateException - if the trajectory has not been loaded yet (i.e. cacheTrajectories() has not been called)
    • getStartPose

      public Pose2d getStartPose()
      Gets the starting pose for the first loaded trajectory.
      Returns:
      The first pose in the first trajectory, or Pose2d.kZero if none
    • getPath

      public Pose2d[] getPath()
      Get the full path as an array of Pose2d
      Returns:
      Array of Pose2d representing the path