code review changes
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / driving / TurnForAngle.java
index 867f5eddf4d5865601fe068cec7739edde4c3732..b95c8223a69fccad10d0f3d3cc2bc882129bb6ed 100755 (executable)
@@ -35,11 +35,16 @@ public class TurnForAngle extends Command {
     this.direction = direction;
     this.maxTimeOut = maxTimeOut;
     this.target = Math.abs(angle);
-    this.zeroAngle = driveTrain.getAngle();
 
-    this.gyroP = driveTrain.turnP;
-    this.gyroI = driveTrain.turnI;
-    this.gyroD = driveTrain.turnD;
+    if (angle > 90) {
+      this.gyroP = driveTrain.largeTurnP;
+      this.gyroI = driveTrain.largeTurnI;
+      this.gyroD = driveTrain.largeTurnD;
+    } else {
+      this.gyroP = driveTrain.smallTurnP;
+      this.gyroI = driveTrain.smallTurnI;
+      this.gyroD = driveTrain.smallTurnD;
+    }
 
     this.gyroController = new PIDController(this.gyroP, this.gyroI, this.gyroD);
     this.gyroController.setDoneRange(1);
@@ -50,6 +55,7 @@ public class TurnForAngle extends Command {
   protected void initialize() {
     this.driveTrain.resetEncoders();
     this.gyroController.setSetPoint(this.target);
+    this.zeroAngle = driveTrain.getAngle();
   }
 
   @Override