Java Example: Register Named Commands - mjansen4857/pathplanner GitHub Wiki
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. A recommended place to do this would be in RobotContainer, after the initialization of your subsystems and before the initialization of any commands that use PathPlanner.
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.
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();
// ...
}