Fix some errors
authorKevin Zhang <icestormf1@gmail.com>
Thu, 11 Feb 2016 04:02:41 +0000 (20:02 -0800)
committerKevin Zhang <icestormf1@gmail.com>
Thu, 11 Feb 2016 04:02:41 +0000 (20:02 -0800)
src/org/usfirst/frc/team3501/robot/subsystems/DefenseArm.java

index 81365c88a1f4bd85b8b75e64106f199373b5ca85..9b745760186031c8c9f4fe0b4e0b599ec500fc4e 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[] potAngles = { 0, 45, 90 };
+
   // angles corresponding to pre-determined heights we will need
 
   public DefenseArm() {
@@ -28,7 +29,6 @@ public class DefenseArm extends Subsystem {
 
     defenseArm = new CANTalon(Constants.DefenseArm.ARM_PORT);
     defenseHand = new CANTalon(Constants.DefenseArm.HAND_PORT);
-    potAngles = createPotArray();
   }
 
   public double getArmPotAngle() {
@@ -50,17 +50,11 @@ 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[] createPotArray() {
-    double[] arr = new double[3];
-
-    for (int i = 0; i < 3; i++) {
-      arr[i] = 45 * i;
-    }
-    return arr;
+  public double getLevelValue(int level) {
+    if (level >= potAngles.length)
+      return potAngles[level];
+    else
+      return 0;
   }
 
   /***