From b3e347d2906bd31aca43a420fe84c2af3cb29744 Mon Sep 17 00:00:00 2001 From: JCasey7135 <126344360+Rachel-M-Greenlee@users.noreply.github.com> Date: Mon, 24 Feb 2025 19:20:58 -0500 Subject: [PATCH] Implemented button for Toggle mode --- src/main/java/frc/robot/RobotContainer.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index c6cf064..1b95b26 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -40,6 +40,7 @@ import frc.robot.subsystems.leds.LEDsCommands; import frc.robot.subsystems.elevator.Elevator.ElevatorPosition; import frc.robot.subsystems.multisubsystemcommands.MultiSubsystemCommands; +import frc.robot.subsystems.multisubsystemcommands.MultiSubsystemCommands.GamepieceMode; import frc.robot.subsystems.multisubsystemcommands.MultiSubsystemCommands.OverallPosition; import frc.robot.subsystems.presets.Preset; @@ -71,6 +72,9 @@ public class RobotContainer { // private final SwerveRequest.FieldCentric drive = new SwerveRequest.FieldCentric() // .withDeadband(MaxSpeed * 0.1).withRotationalDeadband(MaxAngularRate * 0.1) // Add a 10% deadband // .withDriveRequestType(DriveRequestType.OpenLoopVoltage); // Use open-loop control for drive motors + + + private final SwerveRequest.SwerveDriveBrake brake = new SwerveRequest.SwerveDriveBrake(); private final SwerveRequest.PointWheelsAt point = new SwerveRequest.PointWheelsAt(); @@ -87,6 +91,7 @@ public class RobotContainer { private final JoystickButton intakeButton = new JoystickButton(buttonbox1, 7); private final JoystickButton L4_scoreButton = new JoystickButton(buttonbox1, 8); private final JoystickButton spitButton = new JoystickButton(buttonbox1, 9); + private final JoystickButton toggleGamepieceMode = new JoystickButton(buttonbox1, 10); private final GenericHID buttonbox2 = new GenericHID(2); private final JoystickButton presetButton = new JoystickButton(buttonbox2, 2); @@ -228,6 +233,7 @@ private void configureBindings() { L4Button.onTrue(multiSubsystemCommands.setOverallSetpoint(OverallPosition.L4)); LoadingButton.onTrue(multiSubsystemCommands.setOverallSetpoint(OverallPosition.Loading)); L4_scoreButton.onTrue(multiSubsystemCommands.setOverallSetpoint(OverallPosition.L4_Score)); + toggleGamepieceMode.onFalse(Commands.runOnce(() -> multiSubsystemCommands.setGamepieceMode(GamepieceMode.CORAL))).onTrue(Commands.runOnce(() -> multiSubsystemCommands.setGamepieceMode(GamepieceMode.ALGAE))); // Runs the preset to score unless the preset is invalid. joystick.rightBumper().onTrue(