Fix code changes rohan/togglePistons
authorRohan Rodrigues <rohanrodrigues19@gmail.com>
Fri, 10 Mar 2017 00:49:03 +0000 (16:49 -0800)
committerRohan Rodrigues <rohanrodrigues19@gmail.com>
Fri, 10 Mar 2017 00:49:03 +0000 (16:49 -0800)
src/org/usfirst/frc/team3501/robot/Constants.java
src/org/usfirst/frc/team3501/robot/OI.java
src/org/usfirst/frc/team3501/robot/Robot.java
src/org/usfirst/frc/team3501/robot/commands/climber/MaintainClimbedPosition.java
src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java
src/org/usfirst/frc/team3501/robot/commands/shooter/ToggleIndexerPiston.java
src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java

index 26d36bb32c31e6f288f63532b7dd4a0759bfe0b0..f7c7353239cffa53bc325f3daa33a06a26ed4854 100644 (file)
@@ -25,7 +25,7 @@ public class Constants {
     public static final int INCREASE_SHOOTER_SPEED_PORT = 6;
     public static final int DECREASE_SHOOTER_SPEED_PORT = 2;
 
-    public static final int CHANGE_CAMERA_VIEW = 6;
+    public static final int CHANGE_CAMERA_VIEW = 8;
 
     public static final int BRAKE_CANTALONS_PORT = 5;
     public static final int COAST_CANTALONS_PORT = 3;
@@ -40,10 +40,12 @@ public class Constants {
 
     public final static int HALL_EFFECT_PORT = 9;
 
-    public final static int TOGGLE_INDEXER = 8;
+    public final static int TOGGLE_INDEXER = 6;
 
     public static final int MODULE_NUMBER = 10, PISTON_FORWARD = 4,
         PISTON_REVERSE = 5;
+
+    // public static final int MODULE_NUMBER = 10, PISTON = 5;
     public static final Value HIGH_GEAR = DoubleSolenoid.Value.kForward;
     public static final Value LOW_GEAR = DoubleSolenoid.Value.kReverse;
   }
index 16ed17c47527bb4e051eb3e038258fa8bfa4e547..4ea52e6bc798ffa95ab29e59ae90309024350cad 100644 (file)
@@ -85,7 +85,7 @@ public class OI /* implements KeyListener */ {
 
     togglePiston = new JoystickButton(rightJoystick,
         Constants.Shooter.TOGGLE_INDEXER);
-    togglePiston.whenPressed(new ToggleIndexerPiston());
+    togglePiston.toggleWhenPressed(new ToggleIndexerPiston());
 
     toggleDriveTrainPiston = new JoystickButton(rightJoystick,
         Constants.DriveTrain.TOGGLE_DRIVE_PISTON);
index 3778ad0e30dbc7d9ff561a2f502ed927610234ca..566689784afb7270a0954c16645309ed75c32d82 100644 (file)
@@ -29,11 +29,10 @@ public class Robot extends IterativeRobot {
     UsbCamera climberCam = server.startAutomaticCapture("climbercam", 0);
     UsbCamera intakeCam = server.startAutomaticCapture("intakecam", 1);
 
-    driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_COAST_MODE);
+    // driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_COAST_MODE);
   }
 
   public static DriveTrain getDriveTrain() {
-
     return DriveTrain.getDriveTrain();
   }
 
@@ -66,8 +65,8 @@ public class Robot extends IterativeRobot {
   // both set to high gear
   @Override
   public void autonomousInit() {
-    driveTrain.setHighGear();
-    driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_COAST_MODE);
+    // driveTrain.setHighGear();
+    // driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_COAST_MODE);
   }
 
   @Override
@@ -77,7 +76,7 @@ public class Robot extends IterativeRobot {
 
   @Override
   public void teleopInit() {
-    driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_COAST_MODE);
+    // driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_COAST_MODE);
   }
 
   @Override
@@ -89,7 +88,7 @@ public class Robot extends IterativeRobot {
 
   @Override
   public void disabledInit() {
-    driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_BRAKE_MODE);
+    // driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_BRAKE_MODE);
   }
   //
   // @Override
index 88ca8e0904198a6a7f7eb4ca61bd81537ea6a56a..e1a4b30b9cc599e560628ff7d50347931b84bf17 100644 (file)
@@ -42,7 +42,6 @@ public class MaintainClimbedPosition extends Command {
   protected void execute() {
     Robot.getDriveTrain().setMotorValues(DriveTrain.MAINTAIN_CLIMBED_POSITION,
         DriveTrain.MAINTAIN_CLIMBED_POSITION);
-
   }
 
   @Override
index ccc0e4374d6223121eefff87bc28ced1bee495c2..c3a23e5820bd7c8c1f2a05b49c7a9bb471db39ef 100644 (file)
@@ -1,6 +1,5 @@
 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;
@@ -36,16 +35,14 @@ public class RunIndexWheelContinuous extends Command {
 
   @Override
   protected void execute() {
-    if (t.get() >= 1) {
-      if (Shooter.getShooter().getPistonValue() == Constants.Shooter.LOW_GEAR) {
-        Shooter.getShooter().setHighGear();
-      } else {
-        Shooter.getShooter().setLowGear();
-      }
-      t.reset();
-    }
+    /*
+     * if (t.get() >= 1) { if (Shooter.getShooter().getPistonValue() ==
+     * Constants.Shooter.LOW_GEAR) { Shooter.getShooter().setHighGear(); } else
+     * { Shooter.getShooter().setLowGear(); } t.reset(); }
+     */
 
-    if (shooter.isShooterRPMWithinRangeOfTargetSpeed(25))
+    // if (shooter.isShooterRPMWithinRangeOfTargetSpeed(25))
+    if (shooter.getShooterRPM() > 0)
       shooter.runIndexWheel();
 
   }
index a653293d97ad4ca99b0dca5aa21c785415d87917..4b1f09c0698d9714049a5a1cff1330b2cacc5ba7 100644 (file)
@@ -32,6 +32,7 @@ public class ToggleIndexerPiston extends Command {
     } else {
       shooter.setLowGear();
     }
+
   }
 
   // Called once after isFinished returns true
@@ -48,7 +49,7 @@ public class ToggleIndexerPiston extends Command {
 
   @Override
   protected boolean isFinished() {
-    return false;
+    return true;
 
   }
 
index 820bc6a85c25f2429f5cf9c90153d48475914190..07eb10145c0dd2aa782eb76545cf55afeabcace0 100644 (file)
@@ -21,7 +21,7 @@ public class Shooter extends Subsystem {
 
   private static final double RPM_THRESHOLD = 10;
   private static final double DEFAULT_INDEXING_MOTOR_VALUE = -0.75;
-  private static final double DEFAULT_SHOOTING_SPEED = 3100; // rpm
+  private static final double DEFAULT_SHOOTING_SPEED = 2700; // rpm
   private static final double SHOOTING_SPEED_INCREMENT = 50;
   private static final int ACCEPTABLE_SHOOTING_DEVIATION = 300;
 
@@ -39,6 +39,11 @@ public class Shooter extends Subsystem {
 
     piston = new DoubleSolenoid(Constants.Shooter.MODULE_NUMBER,
         Constants.Shooter.PISTON_FORWARD, Constants.Shooter.PISTON_REVERSE);
+
+    /*
+     * piston = new DoubleSolenoid(Constants.Shooter.MODULE_NUMBER,
+     * Constants.Shooter.PISTON);
+     */
   }
 
   /**