// 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.subsystems;
import org.usfirst.frc330.Beachbot2014Java.RobotMap;
import org.usfirst.frc330.Beachbot2014Java.commands.*;
import edu.wpi.first.wpilibj.*;
import edu.wpi.first.wpilibj.command.Subsystem;
/**
 *
 */
public class Shooter extends Subsystem {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
    Solenoid shooter1 = RobotMap.shooterShooter1;
    Solenoid shooter2 = RobotMap.shooterShooter2;
    Solenoid shooter3 = RobotMap.shooterShooter3;
    Solenoid shooter4 = RobotMap.shooterShooter4;
    AnalogChannel shooterUltrasonic = RobotMap.shooterShooterUltrasonic;
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
    
    // Put methods for controlling this subsystem
    // here. Call these from Commands.
    public void initDefaultCommand() {
        // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
	
        // Set the default command for a subsystem here.
        //setDefaultCommand(new MySpecialCommand());
    }
    
    public void shootSolenoidOn() {
        shooter1.set(true);
        shooter2.set(true);
        shooter3.set(true);
        shooter4.set(true);
    }
    
    public void shootSolenoidOff() {
        shooter1.set(false);
        shooter2.set(false);
        shooter3.set(false);
        shooter4.set(false);
    }
    
    
    public double shootSolenoidOffTime() {
        if (!Preferences.getInstance().containsKey("solenoidOffTime"))
        {
            Preferences.getInstance().putDouble("solenoidOffTime", 1.0);
            Preferences.getInstance().save();
        }
        return Preferences.getInstance().getDouble("solenoidOffTime", 1.0);
    }
    
    public double getBallDistance() {
        return shooterUltrasonic.getAverageVoltage() / 0.0098;
    }
}

@@ -2009,23 +2009,22 @@
 nsKey(%22s
-olenoid
+hooter
 OffTime%22
@@ -2078,39 +2078,38 @@
 e().putDouble(%22s
-olenoid
+hooter
 OffTime%22, 1.0);%0A
@@ -2098,27 +2098,27 @@
 erOffTime%22, 
-1.0
+0.2
 );%0A         
@@ -2217,23 +2217,22 @@
 ouble(%22s
-olenoid
+hooter
 OffTime%22
@@ -2233,19 +2233,19 @@
 fTime%22, 
-1.0
+0.2
 );%0A    %7D
@@ -2357,10 +2357,250 @@
 ;%0A    %7D%0A
+    %0A    public boolean isBallInShooter() %7B%0A        return getBallDistance() %3C 9;%0A    %7D%0A    %0A    public boolean isBallInWings() %7B%0A        double ballDistance = getBallDistance();%0A        return ballDistance %3E 20 && ballDistance %3C 60;%0A    %7D%0A
 %7D%0A

Add ball detector ultrasonic sensor