fill in code
authorArunima DIvya <adivya822@student.fuhsd.org>
Thu, 26 Jan 2017 04:02:59 +0000 (20:02 -0800)
committerArunima DIvya <adivya822@student.fuhsd.org>
Thu, 26 Jan 2017 04:33:23 +0000 (20:33 -0800)
src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntake.java

index 6b7caff5658dca64b68708e9a35f137ff3337cbd..5334e7f5ffc77bc3d67f4302c8082ac4913d602f 100644 (file)
@@ -2,6 +2,7 @@ package org.usfirst.frc.team3501.robot.commands.intake;
 
 import org.usfirst.frc.team3501.robot.Robot;
 
+import edu.wpi.first.wpilibj.Timer;
 import edu.wpi.first.wpilibj.command.Command;
 
 /**
@@ -10,35 +11,43 @@ import edu.wpi.first.wpilibj.command.Command;
  * parameters: time to run intake
  */
 public class ReverseIntake extends Command {
+  private double timeToMove;
+  public Timer timer;
 
   public ReverseIntake(double timeToMove) {
     requires(Robot.getIntake());
+    timer = new Timer();
+    this.timeToMove = timeToMove;
   }
 
   // Called just before this Command runs the first time
   @Override
   protected void initialize() {
+    timer.start();
   }
 
   // Called repeatedly when this Command is scheduled to run
   @Override
   protected void execute() {
+    Robot.getIntake().runReverseIntake();
   }
 
   // Make this return true when this Command no longer needs to run execute()
   @Override
   protected boolean isFinished() {
-    return false;
+    return timer.get() >= timeToMove;
   }
 
   // Called once after isFinished returns true
   @Override
   protected void end() {
+    Robot.getIntake().stopIntake();
   }
 
   // Called when another command which requires one or more of the same
   // subsystems is scheduled to run
   @Override
   protected void interrupted() {
+    end();
   }
 }