Add code to toggle agitator pistons in RunIndexWheelContinuous
authorRohan Rodrigues <rohanrodrigues19@gmail.com>
Sat, 4 Mar 2017 20:12:56 +0000 (12:12 -0800)
committerRohan Rodrigues <rohanrodrigues19@gmail.com>
Sat, 4 Mar 2017 20:12:56 +0000 (12:12 -0800)
src/org/usfirst/frc/team3501/robot/Robot.java
src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java

index 455de4e62ec598d5270faa5e97c4a2746d15b380..e72f07e03b85c3a2c8512acf2989800469be42af 100644 (file)
@@ -55,8 +55,7 @@ public class Robot extends IterativeRobot {
   // both set to high gear
   @Override
   public void autonomousInit() {
-    driveTrain.setHighGear(driveTrain.getRightPiston());
-    driveTrain.setHighGear(driveTrain.getLeftPiston());
+    driveTrain.setHighGear();
   }
 
   @Override
index ab46b3fa39f1ca974889abb6f74a87ba89218f43..e86f3ee03f5ec364538de5d033bd2d3ab1057362 100644 (file)
@@ -1,8 +1,8 @@
 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.Timer;
 import edu.wpi.first.wpilibj.command.Command;
 
@@ -30,23 +30,26 @@ public class RunIndexWheelContinuous extends Command {
    */
   public RunIndexWheelContinuous() {
     requires(shooter);
-    // t.start();
   }
 
   // Called just before this Command runs the first time
   @Override
   protected void initialize() {
-    t.reset();
+    t.start();
   }
 
   // Called repeatedly when this Command is scheduled to run
   @Override
   protected void execute() {
-    /*
-     * if (t.get() >= 4) { if (Shooter.getShooter().getPistonValue() ==
-     * Constants.Shooter.LOW_GEAR) { Shooter.getShooter().setHighGear(); } else
-     * { Shooter.getShooter().setLowGear(); } }
-     */
+
+    if (t.get() >= 1) {
+      if (Shooter.getShooter().getPistonValue() == Constants.Shooter.LOW_GEAR) {
+        Shooter.getShooter().setHighGear();
+      } else {
+        Shooter.getShooter().setLowGear();
+      }
+      t.reset();
+    }
 
     double shooterSpeed = shooter.getShooterRPM();
     if (shooterSpeed > 0)