a7ba2297fc74a4493b761063d54f79a8c2245bb5
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / intake / RunIntakeContinuous.java
1 package org.usfirst.frc.team3501.robot.commands.intake;
2
3 import org.usfirst.frc.team3501.robot.Robot;
4 import org.usfirst.frc.team3501.robot.subsystems.Intake;
5
6 import edu.wpi.first.wpilibj.command.Command;
7
8 /***
9 *
10 * Runs the intake continuously when button is pressed, and when button is not
11 * pressed does not run.
12 *
13 * @author Meeta
14 *
15 */
16 public class RunIntakeContinuous extends Command {
17 // create setter method for speed, use setSpeed method to do end() by setting
18 // speed to 0
19
20 public RunIntakeContinuous() {
21 requires(Robot.getIntake());
22 }
23
24 @Override
25 protected boolean isFinished() {
26 // TODO Auto-generated method stub
27 return true;
28 }
29
30 // Called just before this Command runs the first time
31 @Override
32 protected void initialize() {
33
34 }
35
36 // Called repeatedly when this Command is scheduled to run
37 @Override
38 protected void execute() {
39 Robot.getIntake().setSpeed(Robot.getIntake().INTAKE_SPEED);
40 }
41
42 // Called once after isFinished returns true
43 @Override
44 protected void end() {
45 Intake.intake.setSpeed(0);
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 }