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