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 | |
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(); |
4f2fa45c | 22 | |
b7ef589a | 23 | /** |
24 | * See JavaDoc comment in class for details | |
25 | * | |
26 | * @param motorVal | |
27 | * value range from -1 to 1 | |
28 | */ | |
ad7e6b1e | 29 | public RunIndexWheelContinuous() { |
00f515a1 | 30 | requires(shooter); |
4f2fa45c | 31 | } |
32 | ||
33 | // Called just before this Command runs the first time | |
34 | @Override | |
35 | protected void initialize() { | |
36 | } | |
37 | ||
38 | // Called repeatedly when this Command is scheduled to run | |
39 | @Override | |
40 | protected void execute() { | |
d7042bec NA |
41 | double shooterSpeed = shooter.getShooterRPM(); |
42 | if (shooterSpeed > 0) { | |
43 | shooter.setIndexWheelMotorVal(shooter.DEFAULT_INDEXING_SPEED); | |
44 | } | |
4f2fa45c | 45 | } |
46 | ||
47 | // Called once after isFinished returns true | |
48 | @Override | |
49 | protected void end() { | |
135022bc | 50 | shooter.stopIndexWheel(); |
4f2fa45c | 51 | } |
52 | ||
53 | // Called when another command which requires one or more of the same | |
54 | // subsystems is scheduled to run | |
55 | @Override | |
56 | protected void interrupted() { | |
210ebccb | 57 | end(); |
4f2fa45c | 58 | } |
59 | ||
60 | @Override | |
61 | protected boolean isFinished() { | |
2a9dabb1 | 62 | return false; |
adfc0171 | 63 | |
4f2fa45c | 64 | } |
809609c9 | 65 | |
66 | } |