View Single Post
  #1   Spotlight this post!  
Unread 12-02-2014, 11:28
aziobro aziobro is offline
Registered User
FRC #4475 (Terrier Byte Bots)
Team Role: Leadership
 
Join Date: Nov 2008
Rookie Year: 2009
Location: Newark,NJ
Posts: 7
aziobro will become famous soon enough
Using Coniditionals to Build Custom Command Groups

What is the proper way to build a custom command group based on a runtime change?

Example:
Program will look at smartdashboard and get the number of blobs seen.
Based on the number it will either drive straight and shot or
turn, drive straight and shoot.

I tied the following code in the command group constructor.

Code:
if (blobs < 2.0) {
            addSequential(new DriveToLeftAndPrepareShot());
            addSequential(new ShortDelay());
            addSequential(new TossBall3QPower());
            addSequential(new TossBallResetPosition());
            
        }
        else
        {
            addSequential(new DriveToRightAndPrepareShot());
            addSequential(new ShortDelay());
            addSequential(new TossBall3QPower());
            addSequential(new TossBallResetPosition());
        }
But it gets run during program load when the command group is constructed.
I want it to run After autonomous is started.
Reply With Quote