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=531e485014ad72db5239612355b854e0ac6f9e9e;hpb=82fa994f28297c05b15018003f4d0094d303f280;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 531e485..820bc6a 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java @@ -20,9 +20,10 @@ public class Shooter extends Subsystem { private PIDController wheelController; private static final double RPM_THRESHOLD = 10; - private static final double DEFAULT_INDEXING_MOTOR_VALUE = 0.75; - private static final double DEFAULT_SHOOTING_SPEED = 2800; // rpm + 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; + } }