f44631661476e7d309e58abdf663b0d5b75c1fdd
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / intake / ReverseIntakeContinuous.java
1 package org.usfirst.frc.team3501.robot.commands.intake;
2
3 import org.usfirst.frc.team3501.robot.Robot;
4
5 import edu.wpi.first.wpilibj.command.Command;
6
7 /**
8 * Reverses the intake until the button triggering this command is released
9 *
10 * pre-condition: This command must be run by a button in OI with
11 * button.whileHeld(...).
12 */
13 public class ReverseIntakeContinuous extends Command {
14
15 public ReverseIntakeContinuous() {
16 requires(Robot.getIntake());
17 }
18
19 // Called just before this Command runs the first time
20 @Override
21 protected void initialize() {
22 }
23
24 // Called repeatedly when this Command is scheduled to run
25 @Override
26 protected void execute() {
27 Robot.getIntake().runReverseIntake();
28 }
29
30 // Make this return true when this Command no longer needs to run execute()
31 @Override
32 protected boolean isFinished() {
33 return false;
34 }
35
36 // Called once after isFinished returns true
37 @Override
38 protected void end() {
39 Robot.getIntake().stopIntake();
40 }
41
42 // Called when another command which requires one or more of the same
43 // subsystems is scheduled to run
44 @Override
45 protected void interrupted() {
46 end();
47 }
48 }