AutoCommand

The AutoCommand class is used to create the inline command stackup for autonomous routines. To learn more about inline command stackups have a look at the Auto Basics section.

 1package frc.robot.commands.auto;
 2
 3//WPI imports
 4import edu.wpi.first.wpilibj2.command.Command;
 5import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
 6
 7/**
 8 * AutoCommand Class
 9 * <p>
10 * This class is used to create the inline command stackup for autonomous routines
11 */
12public abstract class AutoCommand extends SequentialCommandGroup
13{
14    /**
15     * Base Constructor
16     */
17    public AutoCommand()
18    {
19        super();
20    }
21
22    /**
23     * Overloaded Constructor to create inline commands
24     * <p>
25     * @param cmd The cmd to be executed
26     */
27    public AutoCommand(Command ... cmd)
28    {
29        super(cmd);
30    }
31}
  • Lines 4 & 5 are the required imports for Command and SequentialCommandGroup.

  • Lines 17 - 20 are the base constructor with no parameters.

  • Lines 27 - 30 is the constructor that will be used for most if not all autonomous routines. The parameter will be the inline string of commands to be run.