X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fsubsystems%2FShooter.java;h=820bc6a85c25f2429f5cf9c90153d48475914190;hb=d5498c9f699d654fbb0bf00ddcd837eea8bcc78e;hp=faca5ddac1c1e7b9caabab21298a932c8192e5d0;hpb=cb8e86cb498c12dcf4e2b7a5916fc6f4926b77cf;p=3501%2F2017steamworks diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java index faca5dd..820bc6a 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java @@ -23,6 +23,7 @@ public class Shooter extends Subsystem { private static final double DEFAULT_INDEXING_MOTOR_VALUE = -0.75; private static final double DEFAULT_SHOOTING_SPEED = 3100; // rpm private static final double SHOOTING_SPEED_INCREMENT = 50; + private static final int ACCEPTABLE_SHOOTING_DEVIATION = 300; private double targetShootingSpeed = DEFAULT_SHOOTING_SPEED; private double currentShooterMotorValue = 0; @@ -163,4 +164,17 @@ public class Shooter extends Subsystem { private void changeGear(DoubleSolenoid.Value gear) { piston.set(gear); } + + public boolean isShooterRPMAtTargetSpeed() { + return isShooterRPMWithinRangeOfTargetSpeed(ACCEPTABLE_SHOOTING_DEVIATION); + } + + public boolean isShooterRPMWithinRangeOfTargetSpeed(int acceptableRPMError) { + double shooterSpeed = getShooterRPM(); + if (shooterSpeed > DEFAULT_SHOOTING_SPEED - acceptableRPMError + && shooterSpeed < DEFAULT_SHOOTING_SPEED + acceptableRPMError) { + return true; + } + return false; + } }