write reverse intake method
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / subsystems / Intake.java
index b5e72053c3f90aba576e89913960873b31b99d2b..2ca8776697f1ad6dfe70a1f59a09ae4ce8f34ade 100644 (file)
@@ -10,15 +10,21 @@ import edu.wpi.first.wpilibj.command.Subsystem;
  * @author Meeta
  */
 public class Intake extends Subsystem {
-  public static Intake intake = null;
+  private static Intake intake = null;
   private CANTalon intakeWheel;
   public static final double INTAKE_SPEED = 0;
+  public static final double REVERSE_SPEED = 0;
 
-  // create speed of intake whee
   public Intake() {
     intakeWheel = new CANTalon(Constants.Intake.INTAKE_ROLLER_PORT);
   }
 
+  /***
+   * It gets the intake instance, and if intake has not been initialized, then
+   * it will be initialized.
+   *
+   * @returns intake
+   */
   public static Intake getIntake() {
     if (intake == null) {
       intake = new Intake();
@@ -31,8 +37,37 @@ public class Intake extends Subsystem {
 
   }
 
-  public void setSpeed(double speed) {
+  /***
+   * Sets speed of intake wheel to input speed
+   *
+   * @param speed
+   *          from -1 to 1
+   */
+  private void setSpeed(double speed) {
     intakeWheel.set(speed);
   }
 
+  /***
+   * Runs the intake wheel at the set intake speed.
+   */
+  public void runIntake() {
+    setSpeed(INTAKE_SPEED);
+  }
+
+  /***
+   * Stops the intake wheel by setting intake wheel's speed to 0.
+   */
+  public void stopIntake() {
+    setSpeed(0);
+  }
+
+  /***
+   * Purpose is to release all balls from the ball container to the outside of
+   * the robot. Reverses intake wheel by setting wheel speed to reverse speed.
+   *
+   */
+  public void runReverseIntake() {
+    setSpeed(REVERSE_SPEED);
+  }
+
 }