|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
RobotBuilder parallel commands.
I have been experimenting with robotBuilder and have found a strange occurrence. commands seem to not run in parallel. The two commands both use the same subsystem. When both of them "required" it, the second command would cause the first to stop and replace it. I made it so neither "required" the subsystem, and neither operates on the same part of the subsystem. Now the second one simply does not do anything.(It's simply changing a certain internal variable) does anyone know how to make the two commands work together?
|
|
#2
|
||||
|
||||
|
Re: RobotBuilder parallel commands.
The requires function is in there for a reason: no 2 commands can run in parallel if they require the same subsystem. This is to idiot-proof* the structure so that you don't send conflicting information to a motor/solenoid/etc and confusing the robot. And you need to "require" a subsytem in order to use it, for the same reason as above. Without knowing the details of what you are doing, it is tough for me to make a recommendation, but I will try to offer some general advice. Look at the subsystem you have, and see if it can be divided up into 2+ smaller subsytems. This will eliminate the problem you are currently having, as well as save you a lot of trouble further down the line when you run into other similar problems. If you can't divide up the subsystem, then you are just going to have to figure out how to combine the 2 commands into 1.
Hope this helps. *I say idiot-proof, but its a pretty common mistake, actually, and can cause big problems. |
|
#3
|
||||||
|
||||||
|
Re: RobotBuilder parallel commands.
Paul covered why they can't both run when they both require the subsystem.
Can you give more details over how you are calling them when they both do not require a subsytem and still don't operate in parallel? |
|
#4
|
|||||
|
|||||
|
Re: RobotBuilder parallel commands.
If the two command are not using the same parts of the subsystem you can just remove the requires part of the command. The only issue can you have with this is you will have to make sure the command is going to stop on its own if you need it to stop. We leave some commands without the requires if the all the command is going is actuating a solenoid and is only going to run once, but for the most part your commands should all require the subsystem that they are using.
Here is a beginners guide on Command Based Java that our team presented at the VA FRC Workshop this past fall if you'd like to take a look. Last edited by notmattlythgoe : 20-01-2014 at 07:58. |
|
#5
|
||||
|
||||
|
Re: RobotBuilder parallel commands.
Or, instead of removing the "requires" statement, you could refactor your subsystem into two independent subsystems.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|