add corrections
[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 double time;
17 private double motorVal;
18 private Shooter shooter = Robot.getShooter();
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());
31 this.time = time;
32 this.motorVal = motorVal;
33 }
34
35 @Override
36 protected void initialize() {
37
38 }
39
40 @Override
41 protected void execute() {
42 shooter.runIndexWheelReverse();
43
44 }
45
46 @Override
47 protected boolean isFinished() {
48 return timeSinceInitialized() >= time;
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 }