Command's end is called when enabling the robot

According to the WPILib docs, when disabling the robot through the driver station, all running commands should cancel. This functionality has worked up until recently, but now it interrupts the command instead and the end function is called when re-enabling the robot through the driver station.

This issue has already happened in the past and was fixed in the last update, but has suddenly re-appeared.
We use roboRIO 2.

Does anybody know how to fix this issue?
Thanks.

Canceling and interrupting is the same thing for commands, and it triggers a call to command.end(true).
From where are you calling CommandScheduler.run()? If you’re calling it from robotPeriodic(), all commands will be canceled when the DS mode changes to disabled. If you’re calling it from teleopPeriodic(), the scheduler won’t know the DS mode was disabled (because it doesn’t run at that point), so the commands don’t get canceled. Past that, my hypothesis is that you’re rescheduling commands at teleopInit(), so these new commands interrupt those that were running before the disable.

1 Like