Package choreo.auto

Class AutoFactory

java.lang.Object
choreo.auto.AutoFactory

public class AutoFactory extends Object
A factory used to create autonomous routines.

Here is an example of how to use this class to create an auto routine:

Example using Triggers


 public AutoRoutine shootThenMove(AutoFactory factory) {
   // Create a new auto routine to return
   var routine = factory.newRoutine();

   // Create a trajectory that moves the robot 2 meters
   AutoTrajectory trajectory = factory.trajectory("move2meters", routine);

   // Will automatically run the shoot command when the auto routine is first polled
   routine.enabled().onTrue(shooter.shoot());

   // Gets a trigger from the shooter to if the shooter has a note, and will run the trajectory
   // command when the shooter does not have a note
   routine.enabled().and(shooter.hasNote()).onFalse(trajectory.cmd());

   return routine;
 }
 

Example using CommandGroups


 public Command shootThenMove(AutoFactory factory) {
   // Create a trajectory that moves the robot 2 meters
   Command trajectory = factory.trajectoryCommand("move2meters");

   return shooter.shoot()
      .andThen(trajectory)
      .withName("ShootThenMove");
 }