View Single Post
  #3   Spotlight this post!  
Unread 22-02-2015, 12:59
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,717
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Handling Exceptional Cases in a CommandGroup

What about something like this?

Code:
private Command2 timeoutCommand  = new Command2();

public SomethingCommandGroup() {
     addSequential(new Command1());
     addSequential(timeoutCommand, 5);
     addSequential(new Command3());

}

protected boolean isFinished() {
     return super.isFinished()
          || timeoutCommand.isTimedOut();
}
Since a CommandGroup is still a Command you can override isFinished() to finish if a certain command or several have timed out.

I am unsure if the timed out command will need reinitialized or not. My gut says no.

Last edited by notmattlythgoe : 22-02-2015 at 13:10.
Reply With Quote