Add code for toggleDrivePiston
[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;
ad7e6b1e 4import org.usfirst.frc.team3501.robot.subsystems.Shooter;
210ebccb 5
809609c9 6import 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 */
20public class RunIndexWheelContinuous extends Command {
ad7e6b1e 21 private Shooter shooter = Robot.getShooter();
49b8e933 22 // private Timer t = new Timer();
4f2fa45c 23
b7ef589a 24 /**
25 * See JavaDoc comment in class for details
26 *
27 * @param motorVal
28 * value range from -1 to 1
29 */
ad7e6b1e 30 public RunIndexWheelContinuous() {
00f515a1 31 requires(shooter);
49b8e933 32 // t.start();
4f2fa45c 33 }
34
35 // Called just before this Command runs the first time
36 @Override
37 protected void initialize() {
49b8e933 38 // t.reset();
4f2fa45c 39 }
40
41 // Called repeatedly when this Command is scheduled to run
42 @Override
43 protected void execute() {
49b8e933
RR
44 /*
45 * if (t.get() >= 4) { if (Shooter.getShooter().getPistonValue() ==
46 * Constants.Shooter.LOW_GEAR) { Shooter.getShooter().setHighGear(); } else
47 * { Shooter.getShooter().setLowGear(); } }
48 */
02cde7ca 49
d7042bec 50 double shooterSpeed = shooter.getShooterRPM();
f625e57a
CZ
51 if (shooterSpeed > 0)
52 shooter.runIndexWheel();
4f2fa45c 53 }
54
55 // Called once after isFinished returns true
56 @Override
57 protected void end() {
135022bc 58 shooter.stopIndexWheel();
4f2fa45c 59 }
60
61 // Called when another command which requires one or more of the same
62 // subsystems is scheduled to run
63 @Override
64 protected void interrupted() {
210ebccb 65 end();
4f2fa45c 66 }
67
68 @Override
69 protected boolean isFinished() {
2a9dabb1 70 return false;
adfc0171 71
4f2fa45c 72 }
809609c9 73
74}