competition fixes
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / subsystems / Intake.java
index 15a82a0061eb2bb321eb9ab86b4927c9d777b478..b6c82d484f5f56b03dac38dd6332496972937910 100644 (file)
@@ -1,20 +1,20 @@
 package org.usfirst.frc.team3501.robot.subsystems;
 
 import org.usfirst.frc.team3501.robot.Constants;
+import org.usfirst.frc.team3501.robot.MathLib;
 
 import com.ctre.CANTalon;
 
 import edu.wpi.first.wpilibj.command.Subsystem;
 
 /**
- * Intakes the balls into ball container.
- * 
  * @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 INTAKE_SPEED = 1;
+  public static final double REVERSE_SPEED = -1;
 
   public Intake() {
     intakeWheel = new CANTalon(Constants.Intake.INTAKE_ROLLER_PORT);
@@ -45,7 +45,31 @@ public class Intake extends Subsystem {
    *          from -1 to 1
    */
   public void setSpeed(double speed) {
+    speed = MathLib.restrictToRange(speed, -1.0, 1.0);
     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);
+  }
+
 }