Finalize Shooter and RunIndexWheelContinuous
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / shooter / RunIndexWheelContinuous.java
index 31fda94b45258565c1682306f8c7ada60828c50b..2004c1d506438e2979a3f334f1efa5da251bd908 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;
 
@@ -36,22 +35,23 @@ public class RunIndexWheelContinuous extends Command {
   // Called just before this Command runs the first time
   @Override
   protected void initialize() {
-    t.reset();
+    t.start();
   }
 
   // Called repeatedly when this Command is scheduled to run
   @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();
-    if (shooterSpeed > 0)
+    if (shooter.isShooterRPMWithinRangeOfTargetSpeed(25))
       shooter.runIndexWheel();
   }