Commit | Line | Data |
---|---|---|
21477e1d SG |
1 | package org.usfirst.frc.team3501.robot.commands.shooter; |
2 | ||
3 | import org.usfirst.frc.team3501.robot.Robot; | |
4 | ||
21477e1d SG |
5 | import edu.wpi.first.wpilibj.command.Command; |
6 | ||
7 | /** | |
8 | * This command reverses the index wheel at a given speed for given time in | |
9 | * seconds. | |
10 | * | |
11 | * @author shivanighanta | |
12 | */ | |
13 | ||
14 | public class ReverseIndexWheel extends Command { | |
21477e1d SG |
15 | private double time; |
16 | private double motorVal; | |
17 | ||
18 | /** | |
19 | * See JavaDoc comment in class for details | |
20 | * | |
21 | * @param motorVal | |
22 | * value range from -1 to 1 | |
23 | * @param time | |
24 | * in seconds, amount of time to run index wheel motor | |
25 | */ | |
26 | ||
27 | public ReverseIndexWheel(double time, double motorVal) { | |
28 | requires(Robot.getDriveTrain()); | |
21477e1d SG |
29 | this.time = time; |
30 | this.motorVal = motorVal; | |
31 | } | |
32 | ||
33 | @Override | |
34 | protected void initialize() { | |
21477e1d SG |
35 | |
36 | } | |
37 | ||
38 | @Override | |
39 | protected void execute() { | |
40 | Robot.getShooter().setIndexWheelMotorVal(-motorVal); | |
41 | ||
42 | } | |
43 | ||
44 | @Override | |
45 | protected boolean isFinished() { | |
decaa301 | 46 | return timeSinceInitialized() >= time; |
21477e1d SG |
47 | } |
48 | ||
49 | @Override | |
50 | protected void end() { | |
51 | Robot.getShooter().stopIndexWheel(); | |
52 | ||
53 | } | |
54 | ||
55 | @Override | |
56 | protected void interrupted() { | |
57 | end(); | |
58 | } | |
59 | } |