X-Git-Url: http://challenge-bot.com/repos/?p=3501%2F2017steamworks;a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fcommands%2Fshooter%2FRunIndexWheelContinuous.java;h=1cd3e772762b5cdf6907338997a73fdc4973dde2;hp=815577e24d63cfde14158f23d4d66400b75a636e;hb=f74d236db406193b851bff99e4daec7b7abf35e7;hpb=8275a069e1891bd27156dcd947a897519c42a3a3 diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java index 815577e..1cd3e77 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java @@ -20,11 +20,13 @@ import edu.wpi.first.wpilibj.command.Command; public class RunIndexWheelContinuous extends Command { private Shooter shooter = Robot.getShooter(); + private double previousMotorValue = 0; + private double targetMotorValue = shooter.DEFAULT_INDEXING_MOTOR_VALUE; + /** * See JavaDoc comment in class for details */ public RunIndexWheelContinuous() { - requires(shooter); } @Override @@ -36,8 +38,11 @@ public class RunIndexWheelContinuous extends Command { double shooterSpeed = shooter.getShooterRPM(); double targetShooterSpeed = shooter.getTargetShootingSpeed(); double threshold = shooter.getRPMThreshold(); - if (Math.abs(shooterSpeed - targetShooterSpeed) <= threshold) - shooter.runIndexWheel(); + if (Math.abs(shooterSpeed - targetShooterSpeed) <= threshold) { + double motorValue = (6 * previousMotorValue + targetMotorValue) / 7; + previousMotorValue = motorValue; + shooter.setIndexWheelMotorVal(motorValue); + } } @Override