Commit | Line | Data |
---|---|---|
e911bc8e AD |
1 | package org.usfirst.frc.team3501.robot.commands.intake; |
2 | ||
e52450a4 | 3 | import org.usfirst.frc.team3501.robot.Robot; |
e911bc8e AD |
4 | |
5 | import edu.wpi.first.wpilibj.command.Command; | |
6 | ||
7 | /*** | |
8 | * | |
d8c3d26b AD |
9 | * Runs the intake continuously when button is pressed, and when button is not |
10 | * pressed does not run. | |
e911bc8e | 11 | * |
f407a656 AD |
12 | * Intended to be run inside a .whileHeld() call on a button in OI |
13 | * | |
e911bc8e AD |
14 | * @author Meeta |
15 | * | |
16 | */ | |
17 | public class RunIntakeContinuous extends Command { | |
18 | // create setter method for speed, use setSpeed method to do end() by setting | |
19 | // speed to 0 | |
20 | ||
21 | public RunIntakeContinuous() { | |
e52450a4 | 22 | requires(Robot.getIntake()); |
e911bc8e AD |
23 | } |
24 | ||
25 | @Override | |
26 | protected boolean isFinished() { | |
f407a656 | 27 | return false; |
e911bc8e AD |
28 | } |
29 | ||
30 | // Called just before this Command runs the first time | |
31 | @Override | |
32 | protected void initialize() { | |
1755df31 | 33 | |
e911bc8e AD |
34 | } |
35 | ||
36 | // Called repeatedly when this Command is scheduled to run | |
37 | @Override | |
38 | protected void execute() { | |
1755df31 | 39 | Robot.getIntake().runIntake(); |
e911bc8e AD |
40 | } |
41 | ||
42 | // Called once after isFinished returns true | |
43 | @Override | |
44 | protected void end() { | |
f407a656 | 45 | Robot.getIntake().stopIntake(); |
e911bc8e AD |
46 | } |
47 | ||
48 | // Called when another command which requires one or more of the same | |
49 | // subsystems is scheduled to run | |
50 | @Override | |
51 | protected void interrupted() { | |
52 | end(); | |
53 | } | |
54 | ||
55 | } |