1 package org
.usfirst
.frc
.team3501
.robot
.commands
.shooter
;
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
;
7 import edu
.wpi
.first
.wpilibj
.command
.Command
;
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.
14 * Should only be run from the operator interface.
16 * pre-condition: This command must be run by a button in OI, with
17 * button.whileHeld(...).
19 * @author Shaina & Chris
21 public class RunFlyWheelContinuous
extends Command
{
22 private Shooter shooter
= Robot
.getShooter();
24 private PIDController wheelController
;
25 private double wheelP
;
26 private double wheelI
;
27 private double wheelD
;
28 private double target
;
30 public RunFlyWheelContinuous() {
31 this.wheelP
= this.shooter
.wheelP
;
32 this.wheelI
= this.shooter
.wheelI
;
33 this.wheelD
= this.shooter
.wheelD
;
34 this.wheelController
= new PIDController(this.wheelP
, this.wheelI
,
36 this.wheelController
.setDoneRange(0.5);
37 this.wheelController
.setMaxOutput(1.0);
38 this.wheelController
.setMinDoneCycles(3);
39 this.target
= this.shooter
.CURRENT_SHOOTING_SPEED
;
43 protected void initialize() {
44 this.wheelController
.setSetPoint(this.target
);
48 protected void execute() {
49 // double shooterSpeed = this.wheelController
50 // .calcPID(this.shooter.getShooterRPM());
52 // this.shooter.setFlyWheelMotorVal(shooterSpeed);
53 System
.out
.println(shooter
.getShooterRPM());
54 this.shooter
.setFlyWheelMotorVal(this.shooter
.CURRENT_SHOOTING_SPEED
);
58 protected boolean isFinished() {
63 protected void end() {
64 this.shooter
.stopFlyWheel();
68 protected void interrupted() {