What happens to commands when disabled?

I’m programming a robot using the command-based template, and have a few questions about what happens to commands when the robot is disabled.

When disabled, do running commands get cancelled, continue to run without driving motors, or pause and resume running when the robot reenables?

Similarly, do JoystickButtons and Triggers continue to poll and run commands while disabled?

Thanks for the help.

Answer to what a command does when the robot is disabled is in the Javadoc for one of the methods of the Command class: http://first.wpi.edu/FRC/roborio/release/docs/java/classedu_1_1wpi_1_1first_1_1wpilibj_1_1command_1_1Command.html#a47312c831c1ad06dbbf269d3ec63faa8

As long as you have a call to run the Scheduler in DisabledPeriodic it will cancel any commands that you haven’t run the above method on, run the commands you have (without motors moving) and continue to poll any OI stuff you have mapped and schedule appropriate commands (assuming they are set to run when disabled).

One tactic, if the documentation doesn’t completely answer your questions, is to create a new test Robot project, and put debug statements in interesting places. Then load the test project on the roboRIO, run it, and see what happens in different modes.

For 3081, we often will create a standalone project that tests a particular set of functionality, then copy the code into the main robot project when it’s working well enough.

I have a directory on my development machine that is filled with little test programs (non-robotics) that do this very thing, built up over the years.

1 Like

The FPGA disables the outputs that can control physical action on disable. All the inputs and DS IO are processed as normal. Rather or not your loops executes depends your code. Smart dashboard IO depends on having your loops running in disable. See post 1.