View Single Post
  #5   Spotlight this post!  
Unread 12-02-2014, 15:15
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: Using Coniditionals to Build Custom Command Groups

One thing we did, was stored the hot value in the Robot variable to reference later.

Here is an example of how we did that:

DriveForwardAndWatch:
-drives forward for n seconds
-watches while doing it
-if it determines the goal is hot, writes to the Robot hot variable.

WaitForShot:
-checks to see whether or not the first command saw hot through the Robot hot variable
-if it saw hot, finish
-if it didn't wait for n seconds

Shoot:
-

Not exactly what you were looking for, but may be good enough.

I for one wish there was a better way to do conditional commands, to support more complex state machines (i.e. firing different commands on success, failure, and timeout). However, I've never really been able to get this to work with the wpilib command structure.
__________________
"Never let your schooling interfere with your education" -Mark Twain
Reply With Quote