shooter code review changes
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / shooter / ReverseIndexWheel.java
1 package org.usfirst.frc.team3501.robot.commands.shooter;
2
3 import org.usfirst.frc.team3501.robot.Robot;
4 import org.usfirst.frc.team3501.robot.subsystems.Shooter;
5
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 {
16 private Shooter shooter = Robot.getShooter();
17 private double time;
18
19 /**
20 * See JavaDoc comment in class for details
21 *
22 * @param motorVal
23 * value range from -1 to 1
24 * @param time
25 * in seconds, amount of time to run index wheel motor
26 */
27
28 public ReverseIndexWheel(double time) {
29 requires(Robot.getDriveTrain());
30 this.time = time;
31 }
32
33 @Override
34 protected void initialize() {
35 }
36
37 @Override
38 protected void execute() {
39 shooter.reverseIndexWheel();
40
41 }
42
43 @Override
44 protected boolean isFinished() {
45 return timeSinceInitialized() >= time;
46 }
47
48 @Override
49 protected void end() {
50 shooter.stopIndexWheel();
51
52 }
53
54 @Override
55 protected void interrupted() {
56 end();
57 }
58 }