I’m trying to figure out how to restart (do an end(true) and an initialize()) a long-running command if it’s button is pressed again. The scheduler won’t change anything if it is asked to .schedule() a command that is already running.
1 Like
I’ve never tried it, but may be worth trying to do:
if(command.isScheduled()) {
command.cancel();
}
command.schedule();
So you could put that into the method of say an InstantCommand or something.
Its been a long time since I looked at the Command Scheduler, and there has definitely been a lot of changes to it since I did, but IIRC at one point the way the commands worked was by setting flags in the background to be processed by the Scheduler. Depending on what happens when the cancel is done, and order stuff is processed, it may work.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.