Fix conflict in indexer piston
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / shooter / RunIndexWheelContinuous.java
index 8a640e78951bb7ba007ae6e0f8c764126616127a..ccc0e4374d6223121eefff87bc28ced1bee495c2 100644 (file)
@@ -3,7 +3,6 @@ package org.usfirst.frc.team3501.robot.commands.shooter;
 import org.usfirst.frc.team3501.robot.Constants;
 import org.usfirst.frc.team3501.robot.Robot;
 import org.usfirst.frc.team3501.robot.subsystems.Shooter;
-
 import edu.wpi.first.wpilibj.Timer;
 import edu.wpi.first.wpilibj.command.Command;
 
@@ -32,24 +31,23 @@ public class RunIndexWheelContinuous extends Command {
 
   @Override
   protected void initialize() {
-    t.reset();
+    t.start();
   }
 
   @Override
   protected void execute() {
-    if (t.get() % 1 == 0) {
+    if (t.get() >= 1) {
       if (Shooter.getShooter().getPistonValue() == Constants.Shooter.LOW_GEAR) {
         Shooter.getShooter().setHighGear();
       } else {
         Shooter.getShooter().setLowGear();
       }
+      t.reset();
     }
 
-    double shooterSpeed = shooter.getShooterRPM();
-    double targetShooterSpeed = shooter.getTargetShootingSpeed();
-    double threshold = shooter.getRPMThreshold();
-    if (Math.abs(shooterSpeed - targetShooterSpeed) <= threshold)
+    if (shooter.isShooterRPMWithinRangeOfTargetSpeed(25))
       shooter.runIndexWheel();
+
   }
 
   @Override