shooter code review changes
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / shooter / ReverseIndexWheel.java
CommitLineData
21477e1d
SG
1package org.usfirst.frc.team3501.robot.commands.shooter;
2
3import org.usfirst.frc.team3501.robot.Robot;
f625e57a 4import org.usfirst.frc.team3501.robot.subsystems.Shooter;
21477e1d 5
21477e1d
SG
6import 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
15public class ReverseIndexWheel extends Command {
f625e57a 16 private Shooter shooter = Robot.getShooter();
21477e1d 17 private double time;
21477e1d
SG
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
f625e57a 28 public ReverseIndexWheel(double time) {
21477e1d 29 requires(Robot.getDriveTrain());
21477e1d 30 this.time = time;
21477e1d
SG
31 }
32
33 @Override
34 protected void initialize() {
21477e1d
SG
35 }
36
37 @Override
38 protected void execute() {
f625e57a 39 shooter.reverseIndexWheel();
21477e1d
SG
40
41 }
42
43 @Override
44 protected boolean isFinished() {
decaa301 45 return timeSinceInitialized() >= time;
21477e1d
SG
46 }
47
48 @Override
49 protected void end() {
f625e57a 50 shooter.stopIndexWheel();
21477e1d
SG
51
52 }
53
54 @Override
55 protected void interrupted() {
56 end();
57 }
58}