Cancel all movement

We are creating some auto programs to rotate to a specified angle. If the robot gets stuck against a wall, it will keep trying to rotate but not physically move, so it gets stuck in an infinite loop. I wanted to create a “manual override” command that is called when I press the x button on our xbox controller. The command should cancel all robot movement immediately. I know we could use a timer to exit the loop after 5 seconds or so, but we felt a manual override would be helpful too in case we encounter some accidental bugs mid competition. Would I have to list every command and do Command.cancel()? Or is there some easier way to do this. Thanks!

You can use Scheduler.getInstance().removeAll();

As I read this, you’re using command based. The easy way is to start a new command which requires the appropriate subsystems, and exits immediately. BOOM done!

1 Like