create separate arrays to hold potentiometer angles for hand and arm and add separate...
authorShaina Chen <shaina.sierra@gmail.com>
Thu, 11 Feb 2016 04:53:53 +0000 (20:53 -0800)
committerShaina Chen <shaina.sierra@gmail.com>
Thu, 11 Feb 2016 04:53:53 +0000 (20:53 -0800)
src/org/usfirst/frc/team3501/robot/subsystems/DefenseArm.java

index 81365c88a1f4bd85b8b75e64106f199373b5ca85..c0e9f316962820651c04364a797734843bba5dd8 100755 (executable)
@@ -13,7 +13,8 @@ public class DefenseArm extends Subsystem {
   private CANTalon defenseHand;
   private double hookHeight;
   private double footHeight;
-  private double[] potAngles;
+  private double[] potHandAngles;
+  private double[] potArmAngles;
   // angles corresponding to pre-determined heights we will need
 
   public DefenseArm() {
@@ -28,7 +29,8 @@ public class DefenseArm extends Subsystem {
 
     defenseArm = new CANTalon(Constants.DefenseArm.ARM_PORT);
     defenseHand = new CANTalon(Constants.DefenseArm.HAND_PORT);
-    potAngles = createPotArray();
+    potHandAngles = createHandPotArray();
+    potArmAngles = createArmPotArray();
   }
 
   public double getArmPotAngle() {
@@ -50,11 +52,24 @@ public class DefenseArm extends Subsystem {
    * @return
    *         the angle of the arm corresponding to that arm location
    */
-  public double getAngleForLocation(int desiredArmLocation) {
-    return potAngles[desiredArmLocation];
+  public double getAngleForHandLocation(int desiredArmLocation) {
+    return potHandAngles[desiredArmLocation];
   }
 
-  public double[] createPotArray() {
+  public double getAngleForArmLocation(int desiredArmLocation) {
+    return potArmAngles[desiredArmLocation];
+  }
+
+  public double[] createHandPotArray() {
+    double[] arr = new double[3];
+
+    for (int i = 0; i < 3; i++) {
+      arr[i] = 45 * i;
+    }
+    return arr;
+  }
+
+  public double[] createArmPotArray() {
     double[] arr = new double[3];
 
     for (int i = 0; i < 3; i++) {