/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.subsystems;

import edu.wpi.first.wpilibj.AnalogChannel;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.AnalogChannel;

/**
 *
 * @author Robotics
 */
//this is a test comment to see if git is working
public class BallIntake extends Subsystem {
    // Put methods for controlling this subsystem
    // here. Call these from Commands.
    Victor mechanismDeployer = new Victor(3);
    Victor intakeRoller = new Victor(4);
    AnalogChannel mechanismAngleMeter = new AnalogChannel(4);
    private AnalogChannel ballDetector = new AnalogChannel(5);
    // TODO: fill in the two null
    
    
    public final int groundPickUp = 90;
    public final int threshold = 3;
    public final int shootPosition = 0;
    public final double rollerSpeed = .5;
    public final double angleSpeed = .5;
    public final int ultrasonicValueConsideredIn = 10;
    
    
    
    
    
    
    
    public void deployMechanism (double speed){
        mechanismDeployer.set(speed);
    }
    public void retractMechanism(double speed){
        mechanismDeployer.set(-speed);
    }
    public void mechanismStop(){
    mechanismDeployer.set(0);
    }
    public void ballIntakeRollerIn(double speed){
        intakeRoller.set(speed);
    }
    public void ballIntakeRollerOut(double speed){
        intakeRoller.set(-speed);
    }
    public void ballIntakeRollerStop(){
        intakeRoller.set(0);
    }
    public double mechanismDeltaAngle(int angle){
        return angle - mechanismAngleMeter.getValue();
    }
    public boolean isMechanismWithinThreshold(int angle, double threshold){
        if(mechanismDeltaAngle(angle) < threshold)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    public boolean isBallInMechanism() {
        return ballDetector.getValue() < ultrasonicValueConsideredIn;
    }
            
    
    public void initDefaultCommand() {
        // Set the default command for a subsystem here.
        //setDefaultCommand(new MySpecialCommand());
    }
}

@@ -1,194 +1,4 @@
-/*%0D%0A * To change this license header, choose License Headers in Project Properties.%0D%0A * To change this template file, choose Tools %7C Templates%0D%0A * and open the template in the editor.%0D%0A */%0D%0A
 pack
@@ -52,53 +52,8 @@
 %0D%0A%0D%0A
-import edu.wpi.first.wpilibj.AnalogChannel;%0D%0A
 impo
@@ -179,16 +179,62 @@
 hannel;%0D
+%0Aimport edu.wpi.first.wpilibj.DoubleSolenoid;%0D
 %0A%0D%0A/**%0D%0A
@@ -253,15 +253,17 @@
 or R
-obotics
+yan Pappa
 %0D%0A *
@@ -460,829 +460,336 @@
     
-Victor mechanismDeployer = new Victor(3);%0D%0A    Victor intakeRoller = new Victor(4);%0D%0A    AnalogChannel mechanismAngleMeter = new AnalogChannel(4);%0D%0A    private AnalogChannel ballDetector = new AnalogChannel(5);%0D%0A    // TODO: fill in the two null%0D%0A    %0D%0A    %0D%0A    public final int groundPickUp = 90;%0D%0A    public final int threshold = 3;%0D%0A    public final int shootPosition = 0;%0D%0A    public final double rollerSpeed = .5;%0D%0A    public final double angleSpeed = .5;%0D%0A    public final int ultrasonicValueConsideredIn = 10;%0D%0A    %0D%0A    %0D%0A    %0D%0A    %0D%0A    %0D%0A    %0D%0A    %0D%0A    public void deployMechanism (double speed)%7B%0D%0A        mechanismDeployer.set(speed);%0D%0A    %7D%0D%0A    public void retractMechanism(double speed)%7B%0D%0A        mechanismDeployer.set(-speed);%0D%0A    %7D%0D%0A    public void mechanismStop()%7B%0D%0A    mechanismDeployer.set(0
+private DoubleSolenoid mechanismDeployer1;%0D%0A    private DoubleSolenoid mechanismDeployer2;%0D%0A    private Victor  intakeRoller;%0D%0A    private AnalogChannel ballDetector;%0D%0A    %0D%0A    %0D%0A    public BallIntake()%0D%0A    %7B%0D%0A        mechanismDeployer1 = new DoubleSolenoid(1, 2);%0D%0A        mechanismDeployer2 = new DoubleSolenoid(3, 4
 );%0D%0A    
 %7D%0D%0A 
@@ -788,100 +788,47 @@
     
-%7D%0D%0A
     
-public void ballIntakeRollerIn(double speed)%7B%0D%0A        intakeRoller.set(speed
+intakeRoller = new Victor(4
 );%0D%0A    
 %7D%0D%0A 
@@ -827,94 +827,46 @@
     
-%7D%0D%0A
     
-public void ballIntakeRollerOut(double speed)%7B%0D%0A        intakeRoller.set(-speed
+ballDetector = new AnalogChannel(5
 );%0D%0A
@@ -864,32 +864,38 @@
 nel(5);%0D%0A    %7D%0D%0A
+    %0D%0A
     public void 
@@ -898,258 +898,203 @@
 oid 
-ballIntakeRollerStop
+deployIntake
 ()
-%7B
 %0D%0A    
-    intakeRoller.set(0);
+%7B
 %0D%0A    
-%7D%0D%0A
     
-public double mechanismDeltaAngle(int angle)%7B%0D%0A        return angle - mechanismAngleMeter.getValue();%0D%0A    %7D%0D%0A    public boolean isMechanismWithinThreshold(int angle, double threshold)
+mechanismDeployer1.set(DoubleSolenoid.Value.kForward);%0D%0A        mechanismDeployer2.set(DoubleSolenoid.Value.kForward);%0D%0A    %7D%0D%0A    public void retractIntake()%0D%0A    
 %7B%0D%0A 
@@ -1104,11 +1104,8 @@
     
-if(
 mech
@@ -1115,135 +1115,50 @@
 smDe
-ltaAngle(angle) %3C threshold)%0D%0A        %7B%0D%0A            return true;%0D%0A        %7D%0D%0A        else%0D%0A        %7B%0D%0A            return fal
+ployer1.set(DoubleSolenoid.Value.kRever
 se
+)
 ;%0D%0A 
@@ -1168,150 +1168,69 @@
     
-%7D%0D%0A    %7D%0D%0A    public boolean isBallInMechanism() %7B%0D%0A        return ballDetector.getValue() %3C ultrasonicValueConsideredIn;%0D%0A    %7D%0D%0A            
+mechanismDeployer2.set(DoubleSolenoid.Value.kReverse);%0D%0A    %7D
 %0D%0A  

Redid ball intake. Broke a lot of commands. RP