42cf3bcbef392aaaf9642656e809d9bc69cf042a
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / shooter / ToggleIndexerPiston.java
1 package org.usfirst.frc.team3501.robot.commands.shooter;
2
3 import org.usfirst.frc.team3501.robot.Constants;
4 import org.usfirst.frc.team3501.robot.Robot;
5 import org.usfirst.frc.team3501.robot.subsystems.Shooter;
6
7 import edu.wpi.first.wpilibj.command.Command;
8
9 public class ToggleIndexerPiston extends Command {
10 private Shooter shooter = Robot.getShooter();
11
12 /**
13 * See JavaDoc comment in class for details
14 *
15 * @param motorVal
16 * value range from -1 to 1
17 */
18 public ToggleIndexerPiston() {
19 requires(shooter);
20 }
21
22 // Called just before this Command runs the first time
23 @Override
24 protected void initialize() {
25 }
26
27 // Called repeatedly when this Command is scheduled to run
28 @Override
29 protected void execute() {
30 if (Shooter.getShooter().getPistonValue() == Constants.Shooter.LOW_GEAR) {
31 Shooter.getShooter().setHighGear();
32 } else {
33 Shooter.getShooter().setLowGear();
34 }
35 }
36
37 // Called once after isFinished returns true
38 @Override
39 protected void end() {
40 }
41
42 // Called when another command which requires one or more of the same
43 // subsystems is scheduled to run
44 @Override
45 protected void interrupted() {
46 end();
47 }
48
49 @Override
50 protected boolean isFinished() {
51 return false;
52
53 }
54
55 }