competition fixes
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / shooter / RunFlyWheelContinuous.java
1 package org.usfirst.frc.team3501.robot.commands.shooter;
2
3 import org.usfirst.frc.team3501.robot.Robot;
4 import org.usfirst.frc.team3501.robot.subsystems.Shooter;
5 import org.usfirst.frc.team3501.robot.utils.PIDController;
6
7 import edu.wpi.first.wpilibj.command.Command;
8
9 /**
10 * This command runs the fly wheel continuously at a set speed using a PID
11 * Controller when OI button managing fly wheel is pressed. The command will run
12 * the fly wheel motor until the button triggering it is released.
13 *
14 * Should only be run from the operator interface.
15 *
16 * pre-condition: This command must be run by a button in OI, with
17 * button.whileHeld(...).
18 *
19 * @author Shaina & Chris
20 */
21 public class RunFlyWheelContinuous extends Command {
22 private Shooter shooter = Robot.getShooter();
23
24 private PIDController wheelController;
25
26 public RunFlyWheelContinuous() {
27 requires(shooter);
28 }
29
30 @Override
31 protected void initialize() {
32 shooter.initializePIDController();
33 }
34
35 @Override
36 protected void execute() {
37 shooter.setFlyWheelMotorVal(shooter.calculateShooterSpeed());
38 }
39
40 @Override
41 protected boolean isFinished() {
42 return false;
43 }
44
45 @Override
46 protected void end() {
47 this.shooter.stopFlyWheel();
48 }
49
50 @Override
51 protected void interrupted() {
52 end();
53 }
54 }