shooter code review changes
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / shooter / ReverseIndexWheel.java
index 4c745159b404f53c04a2a47c2866559aecd0fbb3..2ed11b6a398e97d7cdf4e28e03479a9bb1a0e818 100644 (file)
@@ -1,8 +1,8 @@
 package org.usfirst.frc.team3501.robot.commands.shooter;
 
 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;
 
 /**
@@ -13,9 +13,8 @@ import edu.wpi.first.wpilibj.command.Command;
  */
 
 public class ReverseIndexWheel extends Command {
-  Timer timer;
+  private Shooter shooter = Robot.getShooter();
   private double time;
-  private double motorVal;
 
   /**
    * See JavaDoc comment in class for details
@@ -26,33 +25,29 @@ public class ReverseIndexWheel extends Command {
    *          in seconds, amount of time to run index wheel motor
    */
 
-  public ReverseIndexWheel(double time, double motorVal) {
+  public ReverseIndexWheel(double time) {
     requires(Robot.getDriveTrain());
-    timer = new Timer();
     this.time = time;
-    this.motorVal = motorVal;
   }
 
   @Override
   protected void initialize() {
-    timer.start();
-
   }
 
   @Override
   protected void execute() {
-    Robot.getShooter().setIndexWheelMotorVal(-motorVal);
+    shooter.reverseIndexWheel();
 
   }
 
   @Override
   protected boolean isFinished() {
-    return timer.get() >= time;
+    return timeSinceInitialized() >= time;
   }
 
   @Override
   protected void end() {
-    Robot.getShooter().stopIndexWheel();
+    shooter.stopIndexWheel();
 
   }