View Single Post
  #2   Spotlight this post!  
Unread 22-02-2015, 03:33
GeeTwo's Avatar
GeeTwo GeeTwo is online now
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,609
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Handling Exceptional Cases in a CommandGroup

Quote:
Originally Posted by shindigo View Post
Hi all -

I'm looking for some advice on handling exceptional cases in a CommandGroup.

The most common situation we are considering is if one of the commands times out, we want to cancel the whole group, and/or maybe schedule a different group.

Is there any way to do this directly within a CommandGroup or do I have to have the subsystem(s) keep track of what timed out and feed that information on to subsequent commands?

tia -

mp
I haven't tried to do this, but since it's been a couple of days, I'll throw out some possibly wild pitches:

Perhaps if you throw an exception that CommandGroup is not ready for, it will stop execution of the group.

Another possibility (sounds a bit more likely) I found in the documentation was:
Quote:
Any command in the main sequence .. that requires a subsystem in use by a parallel command will cause the parallel command to be canceled.
So, if you start a new command group that requires the same subsystems, it should (as I read the docs) effectively cancel and replace the original command group, which sounds like what you want.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote