Add buttons to move intake arm.
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / subsystems / IntakeArm.java
index 5e00d05f0df999e6870ba06e5b32d8bee168002d..8c87ed1c66a6c5a1172f50cde669607c99628b0f 100755 (executable)
@@ -21,14 +21,16 @@ import edu.wpi.first.wpilibj.command.Subsystem;
 public class IntakeArm extends Subsystem {
 
   private CANTalon intakeRoller;
-  private CANTalon intakeArm;
+  private CANTalon leftIntakeArm;
+  private CANTalon rightIntakeArm;
   private AnalogPotentiometer intakePot;
   public static double[] potAngles = { 0, 30, 45, 90 }; // TODO: correct angles
   public static double moveIntakeArmSpeed = 0;
 
   public IntakeArm() {
     intakeRoller = new CANTalon(Constants.IntakeArm.ROLLER_PORT);
-    intakeArm = new CANTalon(Constants.IntakeArm.ARM_PORT);
+    leftIntakeArm = new CANTalon(Constants.IntakeArm.LEFT_ARM_PORT);
+    rightIntakeArm = new CANTalon(Constants.IntakeArm.RIGHT_ARM_PORT);
     intakePot = new AnalogPotentiometer(Constants.IntakeArm.POT_CHANNEL,
         Constants.IntakeArm.FULL_RANGE, Constants.IntakeArm.OFFSET);
   }
@@ -68,36 +70,58 @@ public class IntakeArm extends Subsystem {
   }
 
   /***
-   * This method sets the voltage of the arm motor. The range is from [-1,1]. A
-   * negative voltage makes the direction of the motor go backwards.
+   * This method sets the voltages of the arm motors. The range is from [-1,1].
+   * negative voltage makes the direction of the motor go backwards.
    *
    * @param voltage
-   *          The voltage that you set the motor at. The range of the voltage of
-   *          the arm motor is from [-1,1]. A negative voltage makes the
-   *          direction of the motor go backwards.
+   *          The voltage that you set the motors at. The range of the voltage
+   *          of the arm motors is from [-1,1]. A negative voltage makes the
+   *          direction of the motors go backwards.
    */
 
-  public void setArmSpeed(double voltage) {
+  public void setArmSpeeds(double voltage) {
     if (voltage > 1)
       voltage = 1;
     else if (voltage < -1)
       voltage = -1;
 
-    intakeArm.set(voltage);
+    leftIntakeArm.set(voltage);
+    rightIntakeArm.set(voltage);
   }
 
   /***
-   * This method gets you the current voltage of the motor that controls the
-   * intake arm. The range of voltage is from [-1,1]. A negative voltage makes
-   * the motor run backwards.
+   * This method gets you the current voltage of the left motor that controls
+   * the intake arm. The range of voltage is from [-1,1]. A negative voltage
+   * makes the motor run backwards.
+   *
+   * @return Returns the voltage of the left motor that controls the arm. The
+   *         range of the voltage goes from [-1,1]. A negative voltage indicates
+   *         that the motor is running backwards.
+   */
+
+  public double getLeftArmSpeed() {
+    return leftIntakeArm.get();
+  }
+
+  /***
+   * This method gets you the current voltage of the right motor that controls
+   * the intake arm. The range of voltage is from [-1,1]. A negative voltage
+   * makes the motor run backwards.
    *
-   * @return Returns the voltage of the motor that controls the arm. The range
-   *         of the voltage goes from [-1,1]. A negative voltage indicates that
-   *         the motor is running backwards.
+   * @return Returns the voltage of the right motor that controls the arm. The
+   *         range of the voltage goes from [-1,1]. A negative voltage indicates
+   *         that the motor is running backwards.
    */
+  public double getRightArmSpeed() {
+    return rightIntakeArm.get();
+  }
+
+  public CANTalon getLeftIntakeArmMotor() {
+    return leftIntakeArm;
+  }
 
-  public double getArmSpeed() {
-    return intakeArm.get();
+  public CANTalon getRightIntakeArmMotor() {
+    return rightIntakeArm;
   }
 
   /***
@@ -137,7 +161,7 @@ public class IntakeArm extends Subsystem {
   }
 
   public void stop() {
-    setArmSpeed(0);
+    setArmSpeeds(0);
   }
 
   public double getAngleForLevel(double targetLevel) {