Add 'requires' command and fill in execute method
[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.
11 *
12 * @author Meeta
13 *
14 */
15 public class RunIntakeContinuous extends Command {
16 // create setter method for speed, use setSpeed method to do end() by setting
17 // speed to 0
18
19 public RunIntakeContinuous() {
20 requires(Robot.getIntake());
21 }
22
23 @Override
24 protected boolean isFinished() {
25 // TODO Auto-generated method stub
26 return true;
27 }
28
29 // Called just before this Command runs the first time
30 @Override
31 protected void initialize() {
32
33 }
34
35 // Called repeatedly when this Command is scheduled to run
36 @Override
37 protected void execute() {
38 Robot.getIntake().setSpeed(Robot.getIntake().INTAKE_SPEED);
39 }
40
41 // Called once after isFinished returns true
42 @Override
43 protected void end() {
44 Intake.intake.setSpeed(0);
45 }
46
47 // Called when another command which requires one or more of the same
48 // subsystems is scheduled to run
49 @Override
50 protected void interrupted() {
51 end();
52 }
53
54 }