code review changes
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / shooter / RunFlyWheelContinuous.java
index c2949386ee0f01eb7a149950b22a7124f223f44a..86c31f7eecd523ebc2a274a6b4d1d58bb74d45ed 100644 (file)
@@ -1,16 +1,53 @@
 package org.usfirst.frc.team3501.robot.commands.shooter;
 
+import org.usfirst.frc.team3501.robot.Robot;
+import org.usfirst.frc.team3501.robot.subsystems.Shooter;
+import org.usfirst.frc.team3501.robot.utils.PIDController;
+
 import edu.wpi.first.wpilibj.command.Command;
 
 /**
- * Runs fly wheel continuously until ________
+ * This command runs the fly wheel continuously at a set speed using a PID
+ * Controller when OI button managing fly wheel is pressed. The command will run
+ * the fly wheel motor until the button triggering it is released.
+ *
+ * Should only be run from the operator interface.
+ *
+ * pre-condition: This command must be run by a button in OI, with
+ * button.whileHeld(...).
+ *
+ * @author Shaina & Chris
  */
 public class RunFlyWheelContinuous extends Command {
+  private Shooter shooter = Robot.getShooter();
+
+  private PIDController wheelController;
+
+  public RunFlyWheelContinuous() {
+  }
+
+  @Override
+  protected void initialize() {
+    shooter.initializePIDController();
+  }
+
+  @Override
+  protected void execute() {
+    shooter.setFlyWheelMotorVal(shooter.calculateShooterSpeed());
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return false;
+  }
 
-       @Override
-       protected boolean isFinished() {
-               // TODO Auto-generated method stub
-               return false;
-       }
+  @Override
+  protected void end() {
+    this.shooter.stopFlyWheel();
+  }
 
+  @Override
+  protected void interrupted() {
+    end();
+  }
 }