Programming
Autonomous
PathPlanner
Named Commands

Named commands

You must register your named commands so that they can be used in the creation of Event Markers and Autos. All of your named commands need to be registered before you create a PathPlanner path or auto in your code. Failure to do so would mean that any named command registered after path/auto creation will not be used in those paths and autos.

All named commands are registered via static methods in the NamedCommands class. The string used when registering a command should be identical to the one used in the PathPlanner GUI.

⚠️

Named commands must be registered before the creation of any PathPlanner Autos or Paths. It is recommended to do this in RobotContainer, after subsystem initialization, but before the creation of any other commands.

Examples

public class RobotContainer() {
    public RobotContainer() {
        // Subsystem initialization
        swerve = new Swerve();
        exampleSubsystem = new ExampleSubsystem();
 
        // Register Named Commands
        NamedCommands.registerCommand("autoBalance", swerve.autoBalanceCommand());
        NamedCommands.registerCommand("exampleCommand", exampleSubsystem.exampleCommand());
        NamedCommands.registerCommand("someOtherCommand", new SomeOtherCommand());
 
        // Do all other initialization
        configureButtonBindings();
 
        // ...
    }
}