![]() |
CommandGroup questions
I have a couple of questions regarding how command groups are processed.
As an example, lets assume that I want to:
I'm assuming the following would generate this sequence: Code:
public static Command buildMyCommand() {Code:
public static Command buildMyCommand() {My next questions have to do with what happens to a command group when things don't complete nicely:
Thanks, Paul |
Re: CommandGroup questions
Quote:
|
Re: CommandGroup questions
Given this expectation:
Quote:
Quote:
Code:
cmd.addSequential(new WaitForChildren());Quote:
Code:
if (cmd != null) {Quote:
Code:
protected boolean isFinished() {Code:
addSequential(new CommandA(),2.0); // times out after 2 seconds |
Re: CommandGroup questions
Thanks for the explanations. If I understand things correctly, when the goal is to build a command group that has the following pattern:
There are at least two ways to code this: Option A: Don't mix addParallel() and addSequential() (use nested CommandGroup objects instead): Code:
public static Command buildMyCommand() {Code:
public static Command buildMyCommand() {Option C: Mix addParallel() and addSequential(), similar to Option B, but uses addParallel() for CommandB and CommandC (which might be slightly more intuitive to look at): Code:
public static Command buildMyCommand() {I think I prefer the nested command groups (Option A) for readability (human comprehension). Unless someone tells me this won't work, I will encourage this general rule of thumb when we introduce CommandGroups to new programmers joining the team (at least to get them started). We will also need to review our command groups and think about the different behaviors between timeouts and interrupted situations. I suspect we have some commands that need to be coded a little more defensively so we don't break things on the robot for certain time outs (if CommandA times out, we may not want to run CommandB in the sequence). Thanks again for the information, Paul |
Re: CommandGroup questions
Quote:
|
| All times are GMT -5. The time now is 22:37. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi