edit continuous commands
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / intake / ReverseIntakeContinuous.java
index bab630da953142a9e95034e66bec90d22e08b1cd..f44631661476e7d309e58abdf663b0d5b75c1fdd 100644 (file)
@@ -1,17 +1,19 @@
 package org.usfirst.frc.team3501.robot.commands.intake;
 
+import org.usfirst.frc.team3501.robot.Robot;
+
 import edu.wpi.first.wpilibj.command.Command;
 
 /**
  * Reverses the intake until the button triggering this command is released
  *
- * pre-condition: button is pressed
+ * pre-condition: This command must be run by a button in OI with
+ * button.whileHeld(...).
  */
 public class ReverseIntakeContinuous extends Command {
 
-  public ReverseIntakeContinuous(double timeToMove) {
-    // Use requires() here to declare subsystem dependencies
-    // eg. requires(chassis);
+  public ReverseIntakeContinuous() {
+    requires(Robot.getIntake());
   }
 
   // Called just before this Command runs the first time
@@ -22,6 +24,7 @@ public class ReverseIntakeContinuous extends Command {
   // 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()
@@ -33,11 +36,13 @@ public class ReverseIntakeContinuous extends Command {
   // 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();
   }
 }