Setting the default command for a subsystem

Once you have some commands created, you can set one of them to be the default command for a subsystem. Default commands run automatically when nothing else is running that requires that subsystem. A good example is having a drive train subsystem with a default command that reads joysticks. That way, whenever the robot program isn't running other commands to operate the drive train under program control, it will operate with joysticks.

Create the command that should be the default for a subsystem

Create the command that should be the default for a subsystem

Here a command is created called "Drive with joysticks" that would read the joystick values and set them in the Drive Train subsystem. This is what the Drive Train should be doing if it isn't being asked to do anything else.

Set the command as the default for the subsystem

Set the command as the default for the subsystem

The "Drive with joysticks" command is set as the default command for the Drive Train subsystem.

You can also set the default Autonomous command, that is the command that runs when the robot enters the Autonomous state.