From 91d09bb18f822ff974714a154235abcacdbab2b0 Mon Sep 17 00:00:00 2001 From: mrwaldron Date: Sat, 29 Feb 2020 20:55:46 +1100 Subject: [PATCH] Finish mapping buttons. Some functionality had to be switched to toggle to match the button design. --- src/main/java/frc/robot/Constants.java | 1 + src/main/java/frc/robot/OI.java | 108 +++++------------- .../java/frc/robot/controller/Controller.java | 26 +++-- .../java/frc/robot/controller/Sequences.java | 93 +++++++++------ src/main/java/frc/robot/controller/State.java | 70 ++++++------ .../frc/robot/lib/RobotConfiguration.java | 4 +- .../java/frc/robot/subsystems/Shooter.java | 12 +- .../java/frc/robot/subsystems/Subsystems.java | 4 +- 8 files changed, 153 insertions(+), 165 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index c8d30f3..a138d11 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -124,6 +124,7 @@ private Constants() { * Shooter constants */ public static final int[] SHOOTER_TALON_CAN_ID_LIST = {30, 31, 32}; + public static final int SHOOTER_HOOD_SOLENOID_PORT = 3; public static final double SHOOTER_SPEED_TOLERANCE_RPM = 600; public static final double SHOOTER_F = 0.18; public static final double SHOOTER_P = 0.7; diff --git a/src/main/java/frc/robot/OI.java b/src/main/java/frc/robot/OI.java index 673e47c..37153ba 100644 --- a/src/main/java/frc/robot/OI.java +++ b/src/main/java/frc/robot/OI.java @@ -48,7 +48,7 @@ public OI(Controller controller, Subsystems subsystems, Log log) { * * Driver Controls: * Left flight joystick: move back/forward, climb up - * Right flight joystick: left/right + * Right flight joystick: left/right, climb up * While held, right joystick top far left button (Button 5): release ratchets * While not held, right joystick top far left button (Button 5): enable ratchets * Right joystick top far right button (Button 6): shift PTO mode @@ -82,97 +82,60 @@ public void configureJoysticks(FlightStick driverLeft, FlightStick driverRight, } - public void configureDriverJoystick(FlightStick leftStick, FlightStick rightStick, String name) { + private void configureDriverJoystick(FlightStick leftStick, FlightStick rightStick, String name) { // Intake onTriggered(rightStick.getButton(1), Sequences.startIntaking()); onUntriggered(rightStick.getButton(1), Sequences.stopIntaking()); - // slowdrive + // Slow drive onTriggered(leftStick.getButton(1), Sequences.startSlowDriveForward()); onUntriggered(leftStick.getButton(1), Sequences.setDrivebaseToArcade()); - // release/enable ratchets (empty sequence) - onTriggered(rightStick.getButton(5), Sequences.getEmptySequence()); - onUntriggered(rightStick.getButton(5), Sequences.getEmptySequence()); + // Release/enable ratchets (empty sequence) + onTriggered(rightStick.getButton(5), Sequences.releaseClimberBrake()); + onUntriggered(rightStick.getButton(5), Sequences.applyClimberBrake()); - // shift PTO mode, toggle (empty sequence) - onTriggered(rightStick.getButton(6), Sequences.getEmptySequence()); - onUntriggered(rightStick.getButton(6), Sequences.getEmptySequence()); + // Toggle drive / climb mode + onTriggered(rightStick.getButton(6), Sequences.toggleDriveClimbModes()); // Vision lineup onTriggered(rightStick.getButton(2), Sequences.visionAim()); - onUntriggered(rightStick.getButton(2), Sequences.getEmptySequence()); + onUntriggered(rightStick.getButton(2), Sequences.setDrivebaseToArcade()); - //onTriggered(rightStick.getButton(4), Sequences.deployBuddyClimber()); - //onTriggered(rightStick.getButton(5), Sequences.retractBuddyClimber()); + //onTriggered(rightStick.getButton(4), Sequences.toggleBuddyClimb()); } - public void configureOperatorJoystick(InputDevice stick, String name) { - // i dont know what the text below is for, its from 2019 - //onTriggered(stick.getButton(GamepadButtonsX.START_BUTTON), Sequences.getStartSequence()); - - //lucas pls finish the colourwheel stuff amogh is confused - - //note: manual adjust doesnt have an untriggered stop on it - //note: drop colourwheel has a seperate button (Y) - - - //colourwheel positional + private void configureOperatorJoystick(InputDevice stick, String name) { + // Colourwheel positional onTriggered(stick.getButton(GamepadButtonsX.A_BUTTON), Sequences.startColourWheelPositional(WheelColour.UNKNOWN)); onUntriggered(stick.getButton(GamepadButtonsX.A_BUTTON), Sequences.stopColourWheel()); - //colourwheel rotational + // Colourwheel rotational onTriggered(stick.getButton(GamepadButtonsX.X_BUTTON), Sequences.startColourWheelRotational()); onUntriggered(stick.getButton(GamepadButtonsX.X_BUTTON), Sequences.stopColourWheel()); - //manual adjust clockwise - onTriggered(stick.getAxis(GamepadButtonsX.LEFT_X_AXIS, GamepadButtonsX.AXIS_THRESHOLD), - () -> { - return Sequences.colourWheelClockwise(); - }); - onUntriggered(stick.getAxis(GamepadButtonsX.LEFT_X_AXIS, GamepadButtonsX.AXIS_THRESHOLD), Sequences.getEmptySequence()); - - //manual adjust anticlockwise - onTriggered(stick.getAxis(GamepadButtonsX.LEFT_X_AXIS, -GamepadButtonsX.AXIS_THRESHOLD), - () -> { - return Sequences.colourWheelAnticlockwise(); - }); - onUntriggered(stick.getAxis(GamepadButtonsX.LEFT_X_AXIS, GamepadButtonsX.AXIS_THRESHOLD), Sequences.getEmptySequence()); - - //deploy/stow colourwheel, toggle (empty sequence) - onTriggered(stick.getButton(GamepadButtonsX.Y_BUTTON), Sequences.getEmptySequence()); - - //shoot (empty sequence) - onTriggered(stick.getAxis(GamepadButtonsX.LEFT_TRIGGER_AXIS, GamepadButtonsX.TRIGGER_THRESHOLD), - () -> { - return Sequences.getEmptySequence(); - }); - onUntriggered(stick.getAxis(GamepadButtonsX.LEFT_TRIGGER_AXIS, GamepadButtonsX.TRIGGER_THRESHOLD), Sequences.getEmptySequence()); - - //shot 1 (empty sequence) - onTriggered(stick.getButton(GamepadButtonsX.LEFT_BUMPER), Sequences.getEmptySequence()); - onUntriggered(stick.getButton(GamepadButtonsX.LEFT_BUMPER), Sequences.getEmptySequence()); + // Colourwheel manual adjust clockwise + onTriggered(stick.getAxis(GamepadButtonsX.LEFT_X_AXIS, GamepadButtonsX.AXIS_THRESHOLD), Sequences.colourWheelClockwise()); + onUntriggered(stick.getAxis(GamepadButtonsX.LEFT_X_AXIS, GamepadButtonsX.AXIS_THRESHOLD), Sequences.stopColourWheel()); - //shot 2 (empty sequence) - onTriggered(stick.getButton(GamepadButtonsX.RIGHT_BUMPER), Sequences.getEmptySequence()); - onUntriggered(stick.getButton(GamepadButtonsX.RIGHT_BUMPER), Sequences.getEmptySequence()); + // Colourwheel manual adjust anticlockwise + onTriggered(stick.getAxis(GamepadButtonsX.LEFT_X_AXIS, -GamepadButtonsX.AXIS_THRESHOLD), Sequences.colourWheelAnticlockwise()); + onUntriggered(stick.getAxis(GamepadButtonsX.LEFT_X_AXIS, GamepadButtonsX.AXIS_THRESHOLD), Sequences.stopColourWheel()); - //buddy climb, toggle (empty sequence) - onTriggered(stick.getButton(GamepadButtonsX.B_BUTTON), Sequences.getEmptySequence()); - onUntriggered(stick.getButton(GamepadButtonsX.B_BUTTON), Sequences.getEmptySequence()); + // Close shot + onTriggered(stick.getAxis(GamepadButtonsX.LEFT_TRIGGER_AXIS, GamepadButtonsX.TRIGGER_THRESHOLD), Sequences.startShooting(/*close=*/true)); + onUntriggered(stick.getAxis(GamepadButtonsX.LEFT_TRIGGER_AXIS, GamepadButtonsX.TRIGGER_THRESHOLD), Sequences.stopShooting()); - // Colour Wheel testing. - onTriggered(stick.getButton(GamepadButtonsX.A_BUTTON), Sequences.startColourWheelPositional(WheelColour.UNKNOWN)); - onUntriggered(stick.getButton(GamepadButtonsX.A_BUTTON), Sequences.stopColourWheel()); - onTriggered(stick.getButton(GamepadButtonsX.X_BUTTON), Sequences.startColourWheelRotational()); - onUntriggered(stick.getButton(GamepadButtonsX.X_BUTTON), Sequences.stopColourWheel()); - onTriggered(stick.getButton(GamepadButtonsX.LEFT_BUMPER), Sequences.colourWheelAnticlockwise()); - onUntriggered(stick.getButton(GamepadButtonsX.LEFT_BUMPER), Sequences.stopColourWheel()); - onTriggered(stick.getButton(GamepadButtonsX.RIGHT_BUMPER), Sequences.colourWheelClockwise()); - onUntriggered(stick.getButton(GamepadButtonsX.RIGHT_BUMPER), Sequences.stopColourWheel()); + // Far shot + onTriggered(stick.getAxis(GamepadButtonsX.LEFT_TRIGGER_AXIS, GamepadButtonsX.TRIGGER_THRESHOLD), Sequences.startShooting(/*close=*/false)); + onUntriggered(stick.getAxis(GamepadButtonsX.LEFT_TRIGGER_AXIS, GamepadButtonsX.TRIGGER_THRESHOLD), Sequences.stopShooting()); + // Spin up shooter. Touch and release the close or far shot buttons to stop shooter wheel. + onTriggered(stick.getButton(GamepadButtonsX.RIGHT_BUMPER), Sequences.spinUpShooter()); + // Buddy climb toggle + onTriggered(stick.getButton(GamepadButtonsX.B_BUTTON), Sequences.toggleBuddyClimb()); } @@ -225,18 +188,7 @@ public void configureDiagBox(InputDevice box) { () -> loaderIF.setPaddleNotBlocking(false)); onTriggered(box.getButton(OperatorBoxButtons.LOADER_PADDLE_NOTBLOCKING), () -> loaderIF.setPaddleNotBlocking(true)); - - //might be outdated already - /* - ClimberInterface climberIF = subsystems.climberOverride.getOverrideInterface(); - // Setup the switch for manual/auto/off modes. - mapOverrideSwitch(box, OperatorBoxButtons.CLIMBER_DISABLE, OperatorBoxButtons.CLIMBER_MANUAL, subsystems.climberOverride); - onTriggered(box.getButton(OperatorBoxButtons.CLIMBER_EXTEND), - () -> climberIF.setDesiredAction(new ClimberAction(Type.SET_BOTH_HEIGHT, - 0.2*box.getAxis(OperatorBoxButtons.CLIMBER_POT).read()))); - */ - -} + } diff --git a/src/main/java/frc/robot/controller/Controller.java b/src/main/java/frc/robot/controller/Controller.java index fd5dd77..9b20ac2 100644 --- a/src/main/java/frc/robot/controller/Controller.java +++ b/src/main/java/frc/robot/controller/Controller.java @@ -11,7 +11,6 @@ import frc.robot.interfaces.ColourWheelInterface.ColourAction; import frc.robot.interfaces.ColourWheelInterface.ColourAction.ColourWheelType; import frc.robot.lib.WheelColour; -import frc.robot.subsystems.ColourWheel; import frc.robot.subsystems.Subsystems; /** @@ -124,11 +123,6 @@ public boolean isAlive() { /** * Does the simple, dumb and most importantly, safe thing. * - * See the design doc before changing this. - * - * Steps through: - Wait for all subsystems to finish moving. - Deploy or - * retract the intake if necessary. - - * * Note if the step asks for something which will cause harm to the robot, the * request will be ignored. For example if the lift was moved into a position * the intake could hit it and then the intake was moved into the lift, the @@ -169,11 +163,24 @@ private void applyState(State desiredState) { subsystems.colourWheel.setArmExtended(desiredState.extendColourWheel); subsystems.colourWheel.setDesiredAction(desiredState.colourAction); + subsystems.shooter.setTargetRPM(desiredState.shooterRPM); + subsystems.shooter.setHoodExtended(desiredState.shooterHoodExtended); + + // Toggle buddy climb if needed + if (desiredState.buddyClimbToggle) { + subsystems.buddyClimb.setExtended(!subsystems.buddyClimb.isExtended()); + } + + // Toggle between drive and climb modes if needed + if (desiredState.driveClimbModeToggle) { + subsystems.drivebase.activateClimbMode(!subsystems.drivebase.isClimbModeEnabled()); + } //subsystems.jevois.setCameraMode(desiredState.cameraMode); maybeWaitForBalls(desiredState.expectedNumberOfBalls); waitForIntake(); + waitForShooterHood(); maybeWaitForShooter(desiredState.shooterUpToSpeed); maybeWaitForColourWheel(); // Wait for driving to finish if needed. @@ -200,7 +207,12 @@ private void waitForIntake() { waitUntil(() -> subsystems.intake.isRetracted() || subsystems.intake.isExtended(), "intake to finish moving"); } - + /** + * Blocks waiting till the shooter hood is in position. + */ + private void waitForShooterHood() { + waitUntil(() -> subsystems.shooter.isHoodExtended() || subsystems.shooter.isHoodRetracted(), "hood to finish moving"); + } /** * Maybe wait for the shooter to get up to the target speed. diff --git a/src/main/java/frc/robot/controller/Sequences.java b/src/main/java/frc/robot/controller/Sequences.java index 0e96e38..2154e74 100644 --- a/src/main/java/frc/robot/controller/Sequences.java +++ b/src/main/java/frc/robot/controller/Sequences.java @@ -2,9 +2,6 @@ * Sequences for doing most actions on the robot. * * If you add a new sequence, add it to allSequences at the end of this file. - * - * Design doc: - * https://docs.google.com/document/d/1IBAw5dKG8hiahRkd8FzU75j3yF6No33oQXtNEKi3LXc/edit# */ package frc.robot.controller; @@ -93,7 +90,10 @@ public static Sequence startSlowDriveForward() { public static Sequence setDrivebaseToArcade() { Sequence seq = new Sequence("Arcade"); - seq.add().doArcadeDrive(); + seq.add().doArcadeDrive() + .setShooterRPM(0) // Turn off everything that may be on. + .retractShooterHood() + .setLoaderSpinnerMotorRPM(0); return seq; } @@ -161,36 +161,53 @@ public static Sequence startLoaderTest() { // Testing methods public static Sequence startIntakingOnly() { - Sequence seq = new Sequence("start Intaking"); + Sequence seq = new Sequence("start intaking"); seq.add().deployIntake(); seq.add().setIntakeMotorOutput(INTAKE_MOTOR_CURRENT).deployIntake(); return seq; } public static Sequence stopIntakingOnly() { - Sequence seq = new Sequence("stop Intaking"); + Sequence seq = new Sequence("stop intaking"); seq.add().setIntakeMotorOutput(0.0); seq.add().stowIntake(); return seq; } + // This is to test the Loader system public static Sequence startLoader() { - Sequence seq = new Sequence("start Loader"); + Sequence seq = new Sequence("start loader"); seq.add().setLoaderSpinnerMotorRPM(LOADER_MOTOR_RPM); return seq; } public static Sequence stopLoader() { - Sequence seq = new Sequence("stop Loader"); + Sequence seq = new Sequence("stop loader"); seq.add().setLoaderSpinnerMotorRPM(0.0); return seq; } - - public static Sequence startShooting() { + + /** + * As the shooter takes time to spin up, enable spinning + * it up in advance. + * Touch the startShooting() sequences to halt. + */ + public static Sequence spinUpShooter() { + Sequence seq = new Sequence("spin up shooter"); + seq.add().setShooterRPM(SHOOTER_TARGET_SPEED_RPM); + return seq; + } + + public static Sequence startShooting(boolean closeToGoal) { Sequence seq = new Sequence("start shooting"); seq.add().setShooterRPM(SHOOTER_TARGET_SPEED_RPM); - // Give the shooter wheel time to spin up. - seq.add().setDelayDelta(2); + if (closeToGoal) { + // Shooting from just below the goal straight up. + seq.add().retractShooterHood(); + } else { + // Shooting from far from the goal at a flat angle. + seq.add().extendShooterHood(); + } // Start the loader to push the balls. seq.add().setLoaderSpinnerMotorRPM(LOADER_MOTOR_RPM); // Wait for the shooter wheel to settle. @@ -233,9 +250,22 @@ public static Sequence stopDriveByVision() { public static Sequence visionAim(){ Sequence seq = new Sequence("vision aim"); seq.add().setShooterRPM(SHOOTER_TARGET_SPEED_RPM); + // Start the loader to push the balls. + seq.add().setLoaderSpinnerMotorRPM(LOADER_MOTOR_RPM); + seq.add().extendShooterHood(); + // Allow the robot to move to aim to the vision target while + // the shooter wheel spins up. seq.add().doVisionAim(); + // Wait for the shooter wheel to settle if it hasn't already. seq.add().waitForShooter(); + // Back to normal driving so it can be adjusted while shooting. seq.add().doArcadeDrive(); + // Let the balls out of the loader and into the shooter. + seq.add().unblockShooter(); + // Wait for all of the balls to leave. + seq.add().waitForBalls(0); + // Turn off everything. + seq.add().setShooterRPM(0).setLoaderPassthroughMotorOutput(0).setLoaderSpinnerMotorRPM(0).blockShooter(); return seq; } @@ -276,41 +306,29 @@ public static Sequence colourWheelClockwise() { return seq; } - // Climber - public static Sequence enableClimbMode() { - Sequence seq = new Sequence("Enable climb mode"); - seq.add().enableClimbMode(); + // Drive / climb mode. + public static Sequence toggleDriveClimbModes() { + Sequence seq = new Sequence("toggle drive / climb modes"); + seq.add().toggleDriveClimbMode(); return seq; } - public static Sequence enableDriveMode() { - Sequence seq = new Sequence("Enable drive mode"); - seq.add().enableDriveMode(); - return seq; - } - - public static Sequence climberBrake() { - Sequence seq = new Sequence("Climber brake apply"); + public static Sequence applyClimberBrake() { + Sequence seq = new Sequence("apply climber brake"); seq.add().applyClimberBrake(); return seq; } - public static Sequence climberStopBrake() { - Sequence seq = new Sequence("Climber brake release"); + public static Sequence releaseClimberBrake() { + Sequence seq = new Sequence("release climber brake"); seq.add().releaseClimberBrake(); return seq; } - // Buddy Climb - public static Sequence deployBuddyClimber() { - Sequence seq = new Sequence("Deploying buddy climb attatchment"); - seq.add().deployBuddyClimb(); - return seq; - } - - public static Sequence retractBuddyClimber() { - Sequence seq = new Sequence("Retracting buddy climb attatchment"); - seq.add().retractBuddyClimb(); + // Toggle buddy climb (deploy / retract) + public static Sequence toggleBuddyClimb() { + Sequence seq = new Sequence("toggle buddy climb attatchment"); + seq.add().toggleBuddyClimb(); return seq; } @@ -322,13 +340,14 @@ public static Sequence retractBuddyClimber() { getResetSequence(), startIntaking(), stopIntaking(), - startShooting(), + startShooting(true), stopShooting(), startIntakingOnly(), stopIntakingOnly(), getDriveToWaypointSequence(0, 12, 0), startLoader(), stopLoader(), + toggleBuddyClimb(), visionAim(), }; } \ No newline at end of file diff --git a/src/main/java/frc/robot/controller/State.java b/src/main/java/frc/robot/controller/State.java index c07c94d..4c36772 100644 --- a/src/main/java/frc/robot/controller/State.java +++ b/src/main/java/frc/robot/controller/State.java @@ -39,6 +39,7 @@ public class State { public Double shooterRPM = null; // Set the shooter target speed. // If this field is not called shooterUpToSpeed plz update applyState() in Controller.java public Boolean shooterUpToSpeed = null; + public Boolean shooterHoodExtended = null; // Loader public Double loaderPassthroughMotorOutput = null; @@ -50,15 +51,13 @@ public class State { // Vision public CameraMode cameraMode = null; - // Climber - public Boolean climbModeEnabled = null; // What the climber should do. + // Driving / Climbing + public DriveRoutineParameters drive = null; + public Boolean driveClimbModeToggle = null; public Boolean climberBrakeApplied = null; // Buddy Climb - public Boolean buddyClimbExtended = null; - - // Driving. - public DriveRoutineParameters drive = null; + public Boolean buddyClimbToggle = null; //Colour Wheel public ColourAction colourAction = null; @@ -77,14 +76,15 @@ public State(Subsystems subsystems, Clock clock) { setDelayUntilTime(clock.currentTime()); intakeMotorOutput = subsystems.intake.getMotorOutput(); intakeExtended = subsystems.intake.isExtended(); - buddyClimbExtended = subsystems.buddyClimb.isExtended(); - climbModeEnabled = subsystems.drivebase.isClimbModeEnabled(); + buddyClimbToggle = false; + driveClimbModeToggle = true; climberBrakeApplied = subsystems.drivebase.isBrakeApplied(); loaderSpinnerMotorRPM = subsystems.loader.getTargetSpinnerMotorRPM(); loaderPassthroughMotorOutput = subsystems.loader.getTargetPassthroughMotorOutput(); loaderPaddleNotBlocking = subsystems.loader.isPaddleNotBlocking(); shooterRPM = subsystems.shooter.getTargetRPM(); shooterUpToSpeed = subsystems.shooter.isAtTargetSpeed(); + shooterHoodExtended = subsystems.shooter.isHoodExtended(); drive = subsystems.drivebase.getDriveRoutine(); colourAction = subsystems.colourWheel.getDesiredAction(); extendColourWheel = subsystems.colourWheel.isArmExtended(); @@ -143,6 +143,16 @@ public State waitForShooter() { return this; } + public State extendShooterHood() { + shooterHoodExtended = true; + return this; + } + + public State retractShooterHood() { + shooterHoodExtended = false; + return this; + } + // Loader public State setLoaderSpinnerMotorRPM(double rpm) { loaderSpinnerMotorRPM = Double.valueOf(rpm); @@ -181,14 +191,9 @@ public State doCameraVision() { } - // Climber - public State enableClimbMode() { - climbModeEnabled = true; - return this; - } - - public State enableDriveMode() { - climbModeEnabled = false; + // Toggle between drive and climb modes + public State toggleDriveClimbMode() { + driveClimbModeToggle = true; return this; } @@ -202,14 +207,12 @@ public State releaseClimberBrake() { return this; } - // Buddy Climb - public State deployBuddyClimb() { - buddyClimbExtended = true; - return this; - } - - public State retractBuddyClimb() { - buddyClimbExtended = true; + /** + * Calling this will retract the buddy climb if it was deployed + * and deploy it if it was retracted. + */ + public State toggleBuddyClimb() { + buddyClimbToggle = true; return this; } @@ -382,21 +385,22 @@ private static void maybeAdd(String name, T value, ArrayList result) @Override public String toString() { ArrayList result = new ArrayList(); + maybeAdd("buddyClimbToggle", buddyClimbToggle, result); + maybeAdd("cameraMode", cameraMode, result); + maybeAdd("colourWheelExtended", extendColourWheel, result); + maybeAdd("colourwheelMode", colourAction, result); + maybeAdd("climberBrakeApplied", climberBrakeApplied, result); + maybeAdd("driveClimbToggle", driveClimbModeToggle, result); + maybeAdd("drive", drive, result); maybeAdd("intakeExtended", intakeExtended, result); maybeAdd("intakeMotorOutput", intakeMotorOutput, result); + maybeAdd("loaderPaddleNotBlocking", loaderPaddleNotBlocking, result); maybeAdd("loaderPassthroughMotorOutput", loaderPassthroughMotorOutput, result); maybeAdd("loaderSpinnerMotorRPM", loaderSpinnerMotorRPM, result); - maybeAdd("loaderPaddleNotBlocking", loaderPaddleNotBlocking, result); - maybeAdd("shooterUpToSpeed", shooterUpToSpeed, result); + maybeAdd("shooterHoodExtended", shooterHoodExtended, result); maybeAdd("shooterRPM", shooterRPM, result); - maybeAdd("drive", drive, result); + maybeAdd("shooterUpToSpeed", shooterUpToSpeed, result); maybeAdd("timeAction", timeAction, result); - maybeAdd("cameraMode", cameraMode, result); - maybeAdd("colourwheelMode", colourAction, result); - maybeAdd("colourWheelExtended", extendColourWheel, result); - maybeAdd("climbModeEnabled", climbModeEnabled, result); - maybeAdd("climberBrakeApplied", climberBrakeApplied, result); - maybeAdd("buddyClimbExtended", buddyClimbExtended, result); return "[" + String.join(",", result) + "]"; } } \ No newline at end of file diff --git a/src/main/java/frc/robot/lib/RobotConfiguration.java b/src/main/java/frc/robot/lib/RobotConfiguration.java index d377712..bd25b37 100644 --- a/src/main/java/frc/robot/lib/RobotConfiguration.java +++ b/src/main/java/frc/robot/lib/RobotConfiguration.java @@ -219,11 +219,11 @@ private void readParameters() { sparkTestIsPresent = getAsBoolean("sparkTest/present", false); sparkTestCanIds = getAsIntArray("sparkTest/canID", Constants.TEST_SPARK_MOTOR_CAN_ID_LIST); - loaderIsPresent = getAsBoolean("loader/present", true); + loaderIsPresent = getAsBoolean("loader/present", false); loaderSpinnerCanID = getAsInt("loader/spinner/canID", Constants.LOADER_SPINNER_MOTOR_CAN_ID); loaderPassthroughCanID = getAsInt("loader/passthrough/canID", Constants.LOADER_PASSTHROUGH_MOTOR_CAN_ID); - shooterIsPresent = getAsBoolean("shooter/present", true); + shooterIsPresent = getAsBoolean("shooter/present", false); shooterCanIds = getAsIntArray("shooter/shooterCanIDs", Constants.SHOOTER_TALON_CAN_ID_LIST); shooterP = getAsDouble("shooter/p", shooterP); diff --git a/src/main/java/frc/robot/subsystems/Shooter.java b/src/main/java/frc/robot/subsystems/Shooter.java index 73dbe45..93558fb 100644 --- a/src/main/java/frc/robot/subsystems/Shooter.java +++ b/src/main/java/frc/robot/subsystems/Shooter.java @@ -17,11 +17,11 @@ public class Shooter extends Subsystem implements ShooterInterface { private final ShooterWheel flyWheel; - private final Solenoid solenoid; + private final Solenoid hood; public Shooter(Motor shooterMotor, Solenoid solenoid, DashboardInterface dashboard, Log log) { super("Shooter", dashboard, log); - this.solenoid = solenoid; + this.hood = solenoid; flyWheel = new ShooterWheel(shooterMotor); log.register(true, () -> isHoodExtended(), "%s/extended", name) .register(true, () -> isHoodRetracted(), "%s/retracted", name); @@ -56,21 +56,21 @@ public boolean isAtTargetSpeed() { @Override public ShooterInterface setHoodExtended(boolean extend) { if (extend) { - solenoid.extend(); + hood.extend(); } else { - solenoid.retract(); + hood.retract(); } return this; } @Override public boolean isHoodExtended() { - return solenoid.isExtended(); + return hood.isExtended(); } @Override public boolean isHoodRetracted() { - return solenoid.isRetracted(); + return hood.isRetracted(); } protected class ShooterWheel { diff --git a/src/main/java/frc/robot/subsystems/Subsystems.java b/src/main/java/frc/robot/subsystems/Subsystems.java index 39fbf34..d7c9ed2 100644 --- a/src/main/java/frc/robot/subsystems/Subsystems.java +++ b/src/main/java/frc/robot/subsystems/Subsystems.java @@ -473,11 +473,11 @@ public void createShooter() { return; } - Solenoid shooterSolenoid = Hardware.Solenoids.singleSolenoid(config.pcmCanId, Constants.INTAKE_SOLENOID_PORT, 0.1, 0.1); + Solenoid hoodSolenoid = Hardware.Solenoids.singleSolenoid(config.pcmCanId, Constants.SHOOTER_HOOD_SOLENOID_PORT, 0.1, 0.1); Motor shooterMotor = MotorFactory.getShooterMotor(config.shooterCanIds, false, config.shooterP, config.shooterI, config.shooterD, config.shooterF, clock, log); - shooter = new Shooter(shooterMotor, shooterSolenoid, dashboard, log); + shooter = new Shooter(shooterMotor, hoodSolenoid, dashboard, log); } public void createShooterOverride() {