Skip to content


The ability for a robot to operate autonomously for a certain period can earn critical match points. Command-based programming is a paradigm used widely in FRC because it modularizes the robot's functionalities into individual commands, which can be chained together into complex routines during autonomous mode.

The Smart Dashboard serves as a GUI for your robot when it is on the field. It can be used to select and observe different autonomous modes in real time.

Writing an Autonomous Mode

  1. Commands and Subsystems: Before diving into the autonomous mode, understand your robot's capabilities. Break down the robot's functionalities into subsystems, like drivetrain, intake, shooter, etc. For each subsystem, you can create specific commands. For instance, for a drivetrain, commands could include DriveForward, Turn, etc.

Sequencing Commands: Once individual commands are created, use command groups to sequence them. Here's a basic example:

public class SimpleAuto extends SequentialCommandGroup {
    public SimpleAuto(Drivetrain drivetrain) {
            new DriveForward(drivetrain, distance, speed),
            new Turn(drivetrain, angle)

In this example, SimpleAuto makes the robot drive forward for a certain distance and then turn by a specific angle.

  1. Setting the Default Autonomous Command: In your Robot class or equivalent:

    @Override public void autonomousInit() { new SimpleAuto(drivetrain).schedule(); }

Multiple Autos and Selection via Smart Dashboard

  1. Creating Multiple Autonomous Commands: Just as we created the SimpleAuto command group, create multiple command groups for each autonomous routine you need.

  2. SendableChooser for Autonomous Selection: The SendableChooser class is used to add multiple autonomous options and then fetch the selected one.

Initialize it:

SendableChooser<Command> m_chooser = new SendableChooser<>();

Populate with autos:

m_chooser.addOption("Simple Auto", new SimpleAuto(drivetrain));
m_chooser.addOption("Complex Auto", new ComplexAuto(drivetrain, shooter));
SmartDashboard.putData("Auto mode", m_chooser);

Retrieving the Selected Auto: In your autonomousInit method, schedule the chosen command:

public void autonomousInit() {

Now, when you deploy your code and open the Smart Dashboard, you should see a dropdown menu labelled "Auto mode". You can select your desired autonomous routine from this dropdown.


  1. Create two or more autonomous routines using command groups.
  2. Set up the SendableChooser in your robot's initialization phase.
  3. Use the Smart Dashboard to select between these routines and test them out to ensure they run as expected during the autonomous phase.


Additional Resources

(WPILib: Command-Based Programming)[]

(WPILib: SmartDashboard and SendableChooser)[]