// RobotBuilder Version: 1.0
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.


package org.usfirst.frc330.Beachbot2014Java.commands;
import edu.wpi.first.wpilibj.command.CommandGroup;
import edu.wpi.first.wpilibj.command.CommandGroupUpdateable;
import org.usfirst.frc330.Beachbot2014Java.Robot;

/**
 *
 */
public class ConditionalHerd extends CommandGroupUpdateable {
    
    public  ConditionalHerd() {
        // Add Commands here:
        // e.g. addSequential(new Command1());
        //      addSequential(new Command2());
        // these will run in order.

        // To run multiple commands at the same time,
        // use addParallel()
        // e.g. addParallel(new Command1());
        //      addSequential(new Command2());
        // Command1 and Command2 will run in parallel.

        // A command group will require all of the subsystems that each member
        // would require.
        // e.g. if Command1 requires chassis, and Command2 requires arm,
        // a CommandGroup containing them would require both the chassis and the
        // arm.
    }
    
    protected void initialize() {
        super.initialize();
        if(Robot.pickup.isBallInPickup()){  //Herd
            addParallel(new PickupPulse());
            addSequential(new MoveArmToCloseLimit());
        }
        else {  //Move to safe
            addSequential(new PickupOff());
            addSequential(new MoveArmToCloseSafePosition());
        }
    }
}

// RobotBuilder Version: 1.0
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.


package org.usfirst.frc330.Beachbot2014Java.commands;
import edu.wpi.first.wpilibj.command.CommandGroup;
import edu.wpi.first.wpilibj.command.CommandGroupUpdateable;
import org.usfirst.frc330.Beachbot2014Java.Robot;

/**
 *
 */
public class ConditionalHerd extends CommandGroupUpdateable {
    
    public  ConditionalHerd() {
        // Add Commands here:
        // e.g. addSequential(new Command1());
        //      addSequential(new Command2());
        // these will run in order.

        // To run multiple commands at the same time,
        // use addParallel()
        // e.g. addParallel(new Command1());
        //      addSequential(new Command2());
        // Command1 and Command2 will run in parallel.

        // A command group will require all of the subsystems that each member
        // would require.
        // e.g. if Command1 requires chassis, and Command2 requires arm,
        // a CommandGroup containing them would require both the chassis and the
        // arm.
        requires(Robot.arm);
        requires(Robot.pickup);
    }
    
    protected void initialize() {
        super.initialize();
        if(Robot.pickup.isBallInPickup()){  //Herd
            addParallel(new PickupPulse());
            addSequential(new MoveArmToCloseLimit());
        }
        else {  //Move to safe
            addSequential(new PickupOff());
            addSequential(new MoveArmToCloseSafePosition());
        }
    }
}

add requires to ConditionalHerd