Add Intake subsystem, filled in methods for Intake commands
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / intake / RunIntake.java
CommitLineData
763ccd44
M
1package org.usfirst.frc.team3501.robot.commands.intake;
2
dab6e7d6
AD
3import org.usfirst.frc.team3501.robot.subsystems.Intake;
4
5import edu.wpi.first.wpilibj.Timer;
763ccd44
M
6import edu.wpi.first.wpilibj.command.Command;
7
8/**
9 *
10 * Starts running the intake for a specific period of time that the user inputs.
e8eb8b46 11 *
763ccd44
M
12 * @author Meeta
13 */
14public class RunIntake extends Command {
e8eb8b46 15 private double timeToMove;
dab6e7d6 16 public Timer timer;
763ccd44 17
e8eb8b46 18 public RunIntake(double timeToMove) {
dab6e7d6 19 timer = new Timer();
e8eb8b46 20 this.timeToMove = timeToMove;
763ccd44
M
21 }
22
23 @Override
24 protected boolean isFinished() {
dab6e7d6 25 return timer.get() >= timeToMove;
763ccd44
M
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() {
dab6e7d6 41 Intake.intake.setSpeed(0);
763ccd44
M
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() {
dab6e7d6 48 end();
763ccd44
M
49 }
50}