Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Parallel commands that depend on the same subsystem? (http://www.chiefdelphi.com/forums/showthread.php?t=125569)

AutoBotAM 31-01-2014 20:27

Parallel commands that depend on the same subsystem?
 
How would the two commands be ran in this situation? Either by running them in parallel in a command group, or if both commands were default commands of different subsystems.

I know that if one command is run that depends on a subsystem that another running command depends on, either of the commands are terminated depending on the circumstances. Is there a way to get two commands to literally run in parallel, accessing the same subsystem? So if commands A and B depend on subsystem C, the scheduler will execute A, then B, A, B, and so on.

Is there a way to get that working?

EDIT:

If there is not, I'll explain my design further. In this case command A would only read information from subsystem C. It would only use accessor methods and no mutator methods. So would it be safe to just omit the "requires" call?

Joe Ross 31-01-2014 21:43

Re: Parallel commands that depend on the same subsystem?
 
Quote:

Originally Posted by AutoBotAM (Post 1335542)
If there is not, I'll explain my design further. In this case command A would only read information from subsystem C. It would only use accessor methods and no mutator methods. So would it be safe to just omit the "requires" call?

Command A does not require exclusive access to Subsystem, so you should not use the requires call.

AutoBotAM 31-01-2014 22:17

Re: Parallel commands that depend on the same subsystem?
 
Quote:

Originally Posted by Joe Ross (Post 1335555)
Command A does not require exclusive access to Subsystem, so you should not use the requires call.

So there isn't a way to do the former. Otherwise answers my question, thanks!

BigJ 01-02-2014 00:33

Re: Parallel commands that depend on the same subsystem?
 
If A and B both "require" C in your case, either you are trying to control the same physical parts of the robot (motor controllers, solenoids, etc) with 2 commands (bad and can have unexpected results), or your subsystem has 2 different (sets of) physical parts that the commands are controlling (in which case you should refactor said subsystem into 2 subsystems).


All times are GMT -5. The time now is 11:00.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi