Add code for toggleDrivePiston
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / shooter / ToggleIndexerPiston.java
diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/ToggleIndexerPiston.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/ToggleIndexerPiston.java
new file mode 100644 (file)
index 0000000..42cf3bc
--- /dev/null
@@ -0,0 +1,55 @@
+package org.usfirst.frc.team3501.robot.commands.shooter;
+
+import org.usfirst.frc.team3501.robot.Constants;
+import org.usfirst.frc.team3501.robot.Robot;
+import org.usfirst.frc.team3501.robot.subsystems.Shooter;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+public class ToggleIndexerPiston extends Command {
+  private Shooter shooter = Robot.getShooter();
+
+  /**
+   * See JavaDoc comment in class for details
+   *
+   * @param motorVal
+   *          value range from -1 to 1
+   */
+  public ToggleIndexerPiston() {
+    requires(shooter);
+  }
+
+  // Called just before this Command runs the first time
+  @Override
+  protected void initialize() {
+  }
+
+  // Called repeatedly when this Command is scheduled to run
+  @Override
+  protected void execute() {
+    if (Shooter.getShooter().getPistonValue() == Constants.Shooter.LOW_GEAR) {
+      Shooter.getShooter().setHighGear();
+    } else {
+      Shooter.getShooter().setLowGear();
+    }
+  }
+
+  // Called once after isFinished returns true
+  @Override
+  protected void end() {
+  }
+
+  // Called when another command which requires one or more of the same
+  // subsystems is scheduled to run
+  @Override
+  protected void interrupted() {
+    end();
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return false;
+
+  }
+
+}