code review changes
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / shooter / RunFlyWheelContinuous.java
CommitLineData
809609c9 1package org.usfirst.frc.team3501.robot.commands.shooter;
2
dbec800d 3import org.usfirst.frc.team3501.robot.Robot;
00f515a1 4import org.usfirst.frc.team3501.robot.subsystems.Shooter;
cf77d84e 5import org.usfirst.frc.team3501.robot.utils.PIDController;
dbec800d 6
809609c9 7import edu.wpi.first.wpilibj.command.Command;
8
9/**
8c09ecc2
CZ
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.
b6e97560 13 *
d4507ede 14 * Should only be run from the operator interface.
15 *
973f0ac4 16 * pre-condition: This command must be run by a button in OI, with
17 * button.whileHeld(...).
357feb5c 18 *
8c09ecc2 19 * @author Shaina & Chris
809609c9 20 */
21public class RunFlyWheelContinuous extends Command {
00f515a1 22 private Shooter shooter = Robot.getShooter();
55cbd9ba 23
cf77d84e 24 private PIDController wheelController;
cf77d84e 25
00f515a1 26 public RunFlyWheelContinuous() {
55cbd9ba 27 }
28
7cd65a82 29 @Override
55cbd9ba 30 protected void initialize() {
7ba6bc91 31 shooter.initializePIDController();
55cbd9ba 32 }
33
7cd65a82 34 @Override
55cbd9ba 35 protected void execute() {
7ba6bc91 36 shooter.setFlyWheelMotorVal(shooter.calculateShooterSpeed());
cf77d84e
CZ
37 }
38
7cd65a82 39 @Override
cf77d84e
CZ
40 protected boolean isFinished() {
41 return false;
55cbd9ba 42 }
43
7cd65a82 44 @Override
55cbd9ba 45 protected void end() {
cf77d84e 46 this.shooter.stopFlyWheel();
55cbd9ba 47 }
48
7cd65a82 49 @Override
55cbd9ba 50 protected void interrupted() {
135022bc 51 end();
55cbd9ba 52 }
809609c9 53}