X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fcommands%2Fshooter%2FRunFlyWheelContinuous.java;h=f751f5be6097237477c651215a700b360b1e6dc2;hb=f74d236db406193b851bff99e4daec7b7abf35e7;hp=047fad40885a8e2f5caad590004cab64493dc5bb;hpb=e32379867a61eb104544b90d917b7ab48d704e25;p=3501%2F2017steamworks diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheelContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheelContinuous.java index 047fad4..f751f5b 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheelContinuous.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheelContinuous.java @@ -22,39 +22,19 @@ public class RunFlyWheelContinuous extends Command { private Shooter shooter = Robot.getShooter(); private PIDController wheelController; - private double wheelP; - private double wheelI; - private double wheelD; - private double target; - double shooterSpeed = 0; public RunFlyWheelContinuous() { - this.wheelP = this.shooter.wheelP; - this.wheelI = this.shooter.wheelI; - this.wheelD = this.shooter.wheelD; - this.wheelController = new PIDController(this.wheelP, this.wheelI, - this.wheelD); - this.wheelController.setDoneRange(10); - this.wheelController.setMaxOutput(1.0); - this.wheelController.setMinDoneCycles(3); - this.target = 2700; + requires(shooter); } @Override protected void initialize() { - this.wheelController.setSetPoint(this.target); + shooter.initializePIDController(); } @Override protected void execute() { - 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); + shooter.setFlyWheelMotorVal(shooter.calculateShooterSpeed()); } @Override