Fix conflicts in ToggleGear
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / shooter / RunIndexWheelContinuous.java
CommitLineData
809609c9 1package org.usfirst.frc.team3501.robot.commands.shooter;
2
210ebccb 3import org.usfirst.frc.team3501.robot.Robot;
fe04fc8e 4import org.usfirst.frc.team3501.robot.Constants;
ad7e6b1e 5import org.usfirst.frc.team3501.robot.subsystems.Shooter;
b6c65122
RR
6<<<<<<< HEAD
7=======
8
9>>>>>>> Remove getters for shift pistons
66945150 10import edu.wpi.first.wpilibj.Timer;
809609c9 11import edu.wpi.first.wpilibj.command.Command;
12
13/**
d4507ede 14 * This command runs index wheel continuously when OI button managing index
15 * wheel is pressed. The command will run the index wheel motor until the button
89a76b33 16 * triggering it is released.
357feb5c 17 *
d4507ede 18 * Should only be run from the operator interface.
19 *
973f0ac4 20 * pre-condition: This command must be run by a button in OI with
21 * button.whileHeld(...).
22 *
27d2386f 23 * @author Shaina
809609c9 24 */
25public class RunIndexWheelContinuous extends Command {
ad7e6b1e 26 private Shooter shooter = Robot.getShooter();
66945150 27 private Timer t = new Timer();
4f2fa45c 28
b7ef589a 29 /**
30 * See JavaDoc comment in class for details
b7ef589a 31 */
ad7e6b1e 32 public RunIndexWheelContinuous() {
00f515a1 33 requires(shooter);
4f2fa45c 34 }
35
4f2fa45c 36 @Override
37 protected void initialize() {
b6c65122 38<<<<<<< HEAD
2d810c3c 39 t.start();
b6c65122
RR
40=======
41 t.reset();
42>>>>>>> Remove getters for shift pistons
4f2fa45c 43 }
44
4f2fa45c 45 @Override
46 protected void execute() {
b092ede2 47 if (t.get() > 1) {
2d810c3c
RR
48 if (Shooter.getShooter().getPistonValue() == Constants.Shooter.LOW_GEAR) {
49 Shooter.getShooter().setHighGear();
50 } else {
51 Shooter.getShooter().setLowGear();
52 }
53 t.reset();
54 }
02cde7ca 55
dd4a8793 56 if (shooter.isShooterRPMWithinRangeOfTargetSpeed(25))
f625e57a 57 shooter.runIndexWheel();
6bc81b55 58
4f2fa45c 59 }
60
4f2fa45c 61 @Override
62 protected void end() {
135022bc 63 shooter.stopIndexWheel();
4f2fa45c 64 }
65
4f2fa45c 66 @Override
67 protected void interrupted() {
210ebccb 68 end();
4f2fa45c 69 }
70
71 @Override
72 protected boolean isFinished() {
2a9dabb1 73 return false;
4f2fa45c 74 }
809609c9 75
76}