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