82bb55001b9c45043fbb42d1d772378e32d4ba01
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / intake / RunIntake.java
1 package org.usfirst.frc.team3501.robot.commands.intake;
2
3 import org.usfirst.frc.team3501.robot.subsystems.Intake;
4
5 import edu.wpi.first.wpilibj.Timer;
6 import edu.wpi.first.wpilibj.command.Command;
7
8 /**
9 *
10 * Starts running the intake for a specific period of time that the user inputs.
11 *
12 * @author Meeta
13 */
14 public class RunIntake extends Command {
15 private double timeToMove;
16 public Timer timer;
17
18 public RunIntake(double timeToMove) {
19 timer = new Timer();
20 this.timeToMove = timeToMove;
21 }
22
23 @Override
24 protected boolean isFinished() {
25 return timer.get() >= timeToMove;
26 }
27
28 // Called just before this Command runs the first time
29 @Override
30 protected void initialize() {
31 }
32
33 // Called repeatedly when this Command is scheduled to run
34 @Override
35 protected void execute() {
36 }
37
38 // Called once after isFinished returns true
39 @Override
40 protected void end() {
41 Intake.intake.setSpeed(0);
42 }
43
44 // Called when another command which requires one or more of the same
45 // subsystems is scheduled to run
46 @Override
47 protected void interrupted() {
48 end();
49 }
50 }