Hi All, I’m stumped on how to temporarily suspend the execution of a command, and have it resume after some event.
Say I have two commands, A and B, Each ‘requires’ the same subsystem. I want A to run, until B is initiated (under operator control), and then B runs to completion (or until interrupted by the operator). Upon B’s completion/interruption, I want A to resume. Later on, again under operator control, B would interrupt A, and the cycle continues.
I’m wrapped around the axle on how the scheduler removes interrupted/cancelled commands, and how to create new ones to take the place of the now cancelled commands. Plus, I don’t see how to do this via the button whenHeld() method, given that takes a command as an argument. Add to that whether a command can be interrupted by another; calling isInterruptible(True or False), and I’m confused.
I’m probably just being dense - but my experience with the WPIlib is that things are generally pretty easy to construct. The fact that I’m having such difficulty says to me I’m just not getting something fundamental.
Thanks for any advice, comment. Note, I may be delayed in any response as I’ll be without ready access to the web/email for a few days. Hopefully the thread’s discussion will aid me when I get access back.
Now that you read it we can discuss your case.
To me, its seems that you want a default command (command that will run as long as the subsystem is not required by any one currently running) which will do action A.
A second command (B) which will start by an OI button (WhileHeld(?)) and another button to stop it.
Or, you can just give each command (A, B) a button, because they require the same subsystem they will just interrupt each other, but if there is no input or one of them just finished none of them will run.
If none if those are correct for you I suggest you give as your specific case.
Many thanks - I had read the referenced doc; but from the perspective of command groups. I had not grasped the significance of the default command. That should help. Also, some searching yielded the below thread that seems to get at the issue I’m grappling with as well.
Ow, so you have a problem with the default command? I will first suggest to check your isFinished
method in the whileHeld command, the isFinished should be false because its a whileHeld command.
If its not the case please provide code samples.