fix shooter commands
authorCindy Zhang <cindyzyx9@gmail.com>
Mon, 20 Feb 2017 19:00:10 +0000 (11:00 -0800)
committerCindy Zhang <cindyzyx9@gmail.com>
Mon, 20 Feb 2017 19:02:30 +0000 (11:02 -0800)
src/org/usfirst/frc/team3501/robot/commands/shooter/ReverseIndexWheelContinuous.java
src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheelContinuous.java

index 79a0f237f18e368ea6dc165e5e525f60b00c44e0..05ab564fe873b15a2435d10adf945c8977ba1024 100644 (file)
@@ -44,6 +44,7 @@ public class ReverseIndexWheelContinuous extends Command {
   // Called once after isFinished returns true
   @Override
   protected void end() {
+    shooter.stopIndexWheel();
   }
 
   // Called when another command which requires one or more of the same
index ff4f65960c69a50ad6114e7993260aa131bee7ff..047fad40885a8e2f5caad590004cab64493dc5bb 100644 (file)
@@ -26,6 +26,7 @@ public class RunFlyWheelContinuous extends Command {
   private double wheelI;
   private double wheelD;
   private double target;
+  double shooterSpeed = 0;
 
   public RunFlyWheelContinuous() {
     this.wheelP = this.shooter.wheelP;
@@ -33,10 +34,10 @@ public class RunFlyWheelContinuous extends Command {
     this.wheelD = this.shooter.wheelD;
     this.wheelController = new PIDController(this.wheelP, this.wheelI,
         this.wheelD);
-    this.wheelController.setDoneRange(0.5);
+    this.wheelController.setDoneRange(10);
     this.wheelController.setMaxOutput(1.0);
     this.wheelController.setMinDoneCycles(3);
-    this.target = this.shooter.getCurrentShootingSpeed();
+    this.target = 2700;
   }
 
   @Override
@@ -46,12 +47,14 @@ public class RunFlyWheelContinuous extends Command {
 
   @Override
   protected void execute() {
-    // double shooterSpeed = this.wheelController
-    // .calcPID(this.shooter.getShooterRPM());
-    //
-    // this.shooter.setFlyWheelMotorVal(shooterSpeed);
-    System.out.println(shooter.getShooterRPM());
-    this.shooter.setFlyWheelMotorVal(this.shooter.CURRENT_SHOOTING_SPEED);
+    double calculatedShooterIncrement = this.wheelController
+        .calcPID(this.shooter.getShooterRPM());
+    shooterSpeed += calculatedShooterIncrement;
+    if (shooterSpeed > 1.0)
+      this.shooter.setFlyWheelMotorVal(1.0);
+    else
+      this.shooter.setFlyWheelMotorVal(shooterSpeed);
+    // this.shooter.setFlyWheelMotorVal(this.shooter.CURRENT_SHOOTING_SPEED);
   }
 
   @Override