Add code to alternate pistons in runIndexWheelContinuous
authorRohan Rodrigues <rohanrodrigues19@gmail.com>
Fri, 3 Mar 2017 00:38:25 +0000 (16:38 -0800)
committerRohan Rodrigues <rohanrodrigues19@gmail.com>
Fri, 3 Mar 2017 00:38:25 +0000 (16:38 -0800)
src/org/usfirst/frc/team3501/robot/Constants.java
src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java

index c2fbf7b121dc7e831d783cf066980d32eb0d4f05..9a80556574c8125f0f88d0e331afacda0a2e2b2c 100644 (file)
@@ -34,6 +34,11 @@ public class Constants {
     public static final int INDEX_WHEEL = 7;
 
     public final static int HALL_EFFECT_PORT = 9;
+
+    public static final int PISTON_MODULE = 10, PISTON_FORWARD = 0,
+        PISTON_REVERSE = 1;
+    public static final Value HIGH_GEAR = DoubleSolenoid.Value.kForward;
+    public static final Value LOW_GEAR = DoubleSolenoid.Value.kReverse;
   }
 
   public static class DriveTrain {
index 34c7e0b4edb4df3a35f671974ee5293d833782f9..31fda94b45258565c1682306f8c7ada60828c50b 100644 (file)
@@ -1,5 +1,6 @@
 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;
 
@@ -41,6 +42,14 @@ public class RunIndexWheelContinuous extends Command {
   // Called repeatedly when this Command is scheduled to run
   @Override
   protected void execute() {
+    if (t.get() % 1 == 0) {
+      if (Shooter.getShooter().getPistonValue() == Constants.Shooter.LOW_GEAR) {
+        Shooter.getShooter().setHighGear();
+      } else {
+        Shooter.getShooter().setLowGear();
+      }
+    }
+
     double shooterSpeed = shooter.getShooterRPM();
     if (shooterSpeed > 0)
       shooter.runIndexWheel();