// 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("shooterOffTime"))
        {
            Preferences.getInstance().putDouble("shooterOffTime", 0.2);
            Preferences.getInstance().save();
        }
        return Preferences.getInstance().getDouble("shooterOffTime", 0.2);
    }
    
    public double getBallDistance() {
        return shooterUltrasonic.getAverageVoltage() / 0.0098;
    }
    
    public boolean isBallInShooter() {
        return getBallDistance() < 9;
    }
    
    public boolean isBallInWings() {
        double ballDistance = getBallDistance();
        return ballDistance > 15 && ballDistance < 50;
    }
}

@@ -722,16 +722,76 @@
 system;%0A
+import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;%0A
 /**%0A *%0A 
@@ -1637,32 +1637,151 @@
 ());%0A    %7D%0A    %0A
+    public Shooter()     %7B%0A        super();%0A        SmartDashboard.putBoolean(%22BallSensorOverride%22, false);%0A    %7D%0A    %0A
     public void 
@@ -2616,16 +2616,74 @@
 ce() %3C 9
+ %7C%7C SmartDashboard.getBoolean(%22BallSensorOverride%22, false)
 ;%0A    %7D%0A
@@ -2769,24 +2769,24 @@
 Distance();%0A
-
         retu
@@ -2826,16 +2826,75 @@
 nce %3C 50
+ %7C%7C !SmartDashboard.getBoolean(%22BallSensorOverride%22, false)
 ;%0A    %7D%0A

add shooter ball sensor override