Predict, then test
- Step once: which command owns the idle subsystem?
- Press and hold, then schedule the conflicting command. Which end method runs and what happens to the motor?
- Finish the conflict while the button remains held. Does the held command return? Release and press again to test.
This teaching model has one subsystem. Its default command holds output at zero. The held command sets +1; a conflicting command sets −1. Each requires the same subsystem. Every button action advances one scheduler cycle. The held binding schedules on the rising edge and cancels on release; interruption does not cause automatic rescheduling while held. This is a simplified illustration, not a full WPILib scheduler implementation.
Step the loop
Lifecycle log, newest last
Explain the result
Scheduling a command with the same requirement interrupts the current
owner. Its end method should leave actuators safe on both
completion and interruption. After the conflict finishes, the default
is scheduled and executes on the next cycle. Releasing a held binding
cancels its still-running command; if it was already interrupted,
release does not cancel the conflict.
WPILib: Command scheduler · WPILib: Binding commands to triggers