|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
COmmand based software Interrupts
Hello again! I'm back with another (possibly) stupid question. Does anyone have any documentation on how command interrupts are handled in command based code? I'm having issues where effectively command 1 which requires subsystem A gets called initially, then before it finishes command 2 gets called which also requires subsystem A, but then they both keep getting called in parallel (I am not using command groups)? I would love to know what exactly goes on inside the code and what order functions are run in, etc., etc., for when situations like these happen.
My google-fu and delphi-fu isn't doing much |
|
#2
|
||||
|
||||
|
Re: COmmand based software Interrupts
Do you have anything in the interrupted function of the first command? The command itself may be ending but whatever it's doing may continue unless you explicitly tell it to stop in the interrupted function. How do you know they both keep getting called in parallel?
Here's some general command based documentation, but it has some specific detail about interrupting and requires(): http://wpilib.screenstepslive.com/s/...uling-commands http://wpilib.screenstepslive.com/s/...ed-programming |
|
#3
|
|||
|
|||
|
Re: COmmand based software Interrupts
Ok thank you so much, that was exactly what I wanted! Also, if you know, how do you make a command non-interruptible? It said that in the flow chart about halfway down the page on the second link you gave me.
|
|
#4
|
||||
|
||||
|
Re: COmmand based software Interrupts
Quote:
|
|
#5
|
|||
|
|||
|
Re: COmmand based software Interrupts
Ok, thank you. I tried using the cancel command in the Interrupted function, but it still did not work :/ do you know how you can force a command to stop once it is interrupted?
|
|
#6
|
|||
|
|||
|
Re: COmmand based software Interrupts
Quote:
You didn't answer the question about how you know they are running in parallel. It shouldn't be possible for two commands that Require the same subsystem to run at the same time. |
|
#7
|
|||
|
|||
|
Re: COmmand based software Interrupts
I'm adding some diagnostics and should be able to test it soon, but I'm assuming that's whats happening because when we call command A that goes to, say, 1000 encoder counts, and then command B (which should go to -1000) before it reaches, it will kinda stutter like it's being repeatedly told to go positive and then zero, going forwards until it hits 1000 and then run in reverse at normal speed until it hits -1000 then stop.
Btw those were arbitrary numbers |
|
#8
|
|||
|
|||
|
Re: COmmand based software Interrupts
Yeah, that's exactly what happened. When we did the printf's, it showed:
CommandA execute CommandB execute CommandA execute CommandB execute CommandA execute CommandB execute CommandA execute CommandB execute CommandA execute CommandB execute CommandA execute CommandB execute |
|
#9
|
|||
|
|||
|
Re: COmmand based software Interrupts
Our code is at https://github.com/Sparky384/Team384...ree/master/src if anyone wants to take a look.
|
|
#10
|
||||
|
||||
|
Re: COmmand based software Interrupts
Is your repository private? Link doesn't work.
For the commands that are running "in parallel". * Do they both require the same subsystem? * What does their isFinished() code look like? * What command is set as the default command for the subsystem? * What does the code in OI look like that associates the commands with buttons (or where is new CommandXYZ() called for each command in question)? |
|
#11
|
||||
|
||||
|
Re: COmmand based software Interrupts
Quote:
Quote:
Also, how are you starting the commands? It's possible they both keep trying to start, and are therefore interrupting each other repeatedly. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|