From f2139d95459dffbe3a48dd62ab6408e04ffaf2df Mon Sep 17 00:00:00 2001 From: Rohan Rodrigues Date: Thu, 9 Mar 2017 16:49:03 -0800 Subject: [PATCH] Fix code changes --- .../usfirst/frc/team3501/robot/Constants.java | 6 ++++-- src/org/usfirst/frc/team3501/robot/OI.java | 2 +- src/org/usfirst/frc/team3501/robot/Robot.java | 11 +++++------ .../climber/MaintainClimbedPosition.java | 1 - .../shooter/RunIndexWheelContinuous.java | 17 +++++++---------- .../commands/shooter/ToggleIndexerPiston.java | 3 ++- .../frc/team3501/robot/subsystems/Shooter.java | 7 ++++++- 7 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/org/usfirst/frc/team3501/robot/Constants.java b/src/org/usfirst/frc/team3501/robot/Constants.java index 26d36bb..f7c7353 100644 --- a/src/org/usfirst/frc/team3501/robot/Constants.java +++ b/src/org/usfirst/frc/team3501/robot/Constants.java @@ -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; } diff --git a/src/org/usfirst/frc/team3501/robot/OI.java b/src/org/usfirst/frc/team3501/robot/OI.java index 16ed17c..4ea52e6 100644 --- a/src/org/usfirst/frc/team3501/robot/OI.java +++ b/src/org/usfirst/frc/team3501/robot/OI.java @@ -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); diff --git a/src/org/usfirst/frc/team3501/robot/Robot.java b/src/org/usfirst/frc/team3501/robot/Robot.java index 3778ad0..5666897 100644 --- a/src/org/usfirst/frc/team3501/robot/Robot.java +++ b/src/org/usfirst/frc/team3501/robot/Robot.java @@ -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 diff --git a/src/org/usfirst/frc/team3501/robot/commands/climber/MaintainClimbedPosition.java b/src/org/usfirst/frc/team3501/robot/commands/climber/MaintainClimbedPosition.java index 88ca8e0..e1a4b30 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/climber/MaintainClimbedPosition.java +++ b/src/org/usfirst/frc/team3501/robot/commands/climber/MaintainClimbedPosition.java @@ -42,7 +42,6 @@ public class MaintainClimbedPosition extends Command { protected void execute() { Robot.getDriveTrain().setMotorValues(DriveTrain.MAINTAIN_CLIMBED_POSITION, DriveTrain.MAINTAIN_CLIMBED_POSITION); - } @Override diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java index ccc0e43..c3a23e5 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java @@ -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(); } diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/ToggleIndexerPiston.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/ToggleIndexerPiston.java index a653293..4b1f09c 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/ToggleIndexerPiston.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/ToggleIndexerPiston.java @@ -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; } diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java index 820bc6a..07eb101 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java @@ -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); + */ } /** -- 2.30.2