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