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. If it takes parameters, a row will appear in the table to set the parameters.

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

0 Report Errors

Use this form to report any errors with the documentation. For help with WPILib, please use the FIRST Forums at http://forums.usfirst.org For reporting WPILib bugs, please submit an issue on GitHub at https://github.com/wpilibsuite/allwpilib/issues/new

Ignore