But the enable function is actually skipped because the robot is never registered as disabled (and thus, internally, wasDisabled == false). This fixes that issue so that even if the robot is enabled immediately upon starting the program, the enable method is still called.
Surprisingly enough, this isn't even just an issue in simulations -- mash the "Enable" button on the Driver Station fast enough while the robot is booting up or after pushing code and the enable function sometimes fails to get called!
Imagine this robot code:
You'd expect the following to be printed:
But the
enable
function is actually skipped because the robot is never registered as disabled (and thus, internally,wasDisabled == false
). This fixes that issue so that even if the robot is enabled immediately upon starting the program, theenable
method is still called.Surprisingly enough, this isn't even just an issue in simulations -- mash the "Enable" button on the Driver Station fast enough while the robot is booting up or after pushing code and the
enable
function sometimes fails to get called!