View Single Post
  #6   Spotlight this post!  
Unread 26-02-2015, 15:53
shindigo shindigo is offline
Registered User
AKA: Mike Parker
FRC #0102
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2009
Location: Somerville, NJ
Posts: 33
shindigo is an unknown quantity at this point
Re: Handling Exceptional Cases in a CommandGroup

Hi all -

We tested out a successful solution last night: as GeeTwo suggested, a command that requires the same subsystem(s) as a scheduled command will interrupt the scheduled commands.

So in the original Command (within the CommandGroup) when we get a timeout, we schedule a new Command with (something like)

Scheduler.Instance.Add(New StopAllMotors());

This StopAllMotors command requires all subsystems that we want to stop, thus interrupting any running commands.

This works in practice for us - we can see running commands getting interrupted and canceled.

I suppose if we wanted to extend this to do something other than stop all motors, we could try something like:

Scheduler.Instance.Add(New InterruptAllCommands());
Scheduler.Instance.Add(New ExecutePlanB());

Where InterruptAllCommands is a command that just requires all the subsystems we want to reset and ExecutePlanB is our CommandGroup to execute an alternative autonomous plan.

Thanks again for all your great suggestions. Hope someone else profits from this...

mp
Reply With Quote