From 7ea99b9af29d995bc47371e4104ff1f3b58bec2e Mon Sep 17 00:00:00 2001 From: C4llSiqn Date: Wed, 26 Apr 2023 11:42:48 -0600 Subject: [PATCH] "HotWire" fixes --- .../java/frc4388/robot/RobotContainer.java | 127 ++++++++++++++---- 1 file changed, 99 insertions(+), 28 deletions(-) diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index faa7987..7d3a71a 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -31,17 +31,25 @@ public class RobotContainer { /* Subsystems */ private final Drive m_robotDrive = new Drive(m_robotMap.driveMotorLeftLeader, m_robotMap.driveMotorRightLeader, m_robotMap.driveBase); - private final Shooter m_robotShooterBottomLeftOuter = new Shooter(m_robotMap.shooterSolenoidBottomLeftOuter); - private final Shooter m_robotShooterBottomLeftInner = new Shooter(m_robotMap.shooterSolenoidBottomLeftInner); - private final Shooter m_robotShooterBottomRightInner = new Shooter(m_robotMap.shooterSolenoidBottomRightInner); - private final Shooter m_robotShooterBottomRightOuter = new Shooter(m_robotMap.shooterSolenoidBottomRightOuter); + private final Shooter m_robotShooterBottomLeft = new Shooter(m_robotMap.shooterSolenoidBottomLeft); + private final Shooter m_robotShooterBottomMiddle = new Shooter(m_robotMap.shooterSolenoidBottomMiddle); + private final Shooter m_robotShooterBottomRight = new Shooter(m_robotMap.shooterSolenoidBottomRight); + + private final Shooter m_robotShooterTopLeft = new Shooter(m_robotMap.shooterSolenoidTopLeft); + private final Shooter m_robotShooterTopMiddle = new Shooter(m_robotMap.shooterSolenoidTopMiddle); + private final Shooter m_robotShooterTopRight = new Shooter(m_robotMap.shooterSolenoidTopRight); - private final Shooter m_robotShooterTopLeftOuter = new Shooter(m_robotMap.shooterSolenoidTopLeftOuter); - private final Shooter m_robotShooterTopLeftInner = new Shooter(m_robotMap.shooterSolenoidTopLeftInner); - private final Shooter m_robotShooterTopRightInner = new Shooter(m_robotMap.shooterSolenoidTopRightInner); - private final Shooter m_robotShooterTopRightOuter = new Shooter(m_robotMap.shooterSolenoidTopRightOuter); + // private final Shooter m_robotShooterBottomLeftOuter = new Shooter(m_robotMap.shooterSolenoidBottomLeftOuter); + // private final Shooter m_robotShooterBottomLeftInner = new Shooter(m_robotMap.shooterSolenoidBottomLeftInner); + // private final Shooter m_robotShooterBottomRightInner = new Shooter(m_robotMap.shooterSolenoidBottomRightInner); + // private final Shooter m_robotShooterBottomRightOuter = new Shooter(m_robotMap.shooterSolenoidBottomRightOuter); - private final Horn m_robotHorn = new Horn(m_robotMap.hornSolenoid); + // private final Shooter m_robotShooterTopLeftOuter = new Shooter(m_robotMap.shooterSolenoidTopLeftOuter); + // private final Shooter m_robotShooterTopLeftInner = new Shooter(m_robotMap.shooterSolenoidTopLeftInner); + // private final Shooter m_robotShooterTopRightInner = new Shooter(m_robotMap.shooterSolenoidTopRightInner); + // private final Shooter m_robotShooterTopRightOuter = new Shooter(m_robotMap.shooterSolenoidTopRightOuter); + + // private final Horn m_robotHorn = new Horn(m_robotMap.hornSolenoid); /* Controllers */ private final XboxController m_controller = new XboxController(OIConstants.CONTROLLER_ID); @@ -64,28 +72,50 @@ public class RobotContainer { * {@link edu.wpi.first.wpilibj2.command.button.JoystickButton}. */ private void configureButtonBindings() { - // Y Button: Fire Top Lefter Shooter - new JoystickButton(getController(), XboxController.Button.kY.value).whenPressed(putToDashboard("Y", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterTopLeftOuter)).withName("Fire Top Lefter"))); - // B Button: Fire Top Right Shooter - new JoystickButton(getController(), XboxController.Button.kB.value).whenPressed(putToDashboard("B", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterTopRightInner)).withName("Fire Top Right"))); - // A Button: Fire Top Righter Shooter - new JoystickButton(getController(), XboxController.Button.kA.value).whenPressed(putToDashboard("A", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterTopRightOuter)).withName("Fire Top Righter"))); // X Button: Fire Top Left Shooter - new JoystickButton(getController(), XboxController.Button.kX.value).whenPressed(putToDashboard("X", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterTopLeftInner)).withName("Fire Top Left"))); - - // D-Pad Up: Fire Bottom Lefter Shooter - new POVButton(getController(), 0).whenPressed(putToDashboard("Up", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterBottomLeftOuter)).withName("Fire Bottom Lefter"))); - // D-Pad Right: Fire Bottom Right Shooter - new POVButton(getController(), 90).whenPressed(putToDashboard("Right", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterBottomRightInner)).withName("Fire Bottom Right"))); + new JoystickButton(getController(), XboxController.Button.kX.value).whenPressed(() -> fireShooterWithFeedback(m_robotShooterTopLeft)); + // Y Button: Fire Top Middle Shooter + new JoystickButton(getController(), XboxController.Button.kY.value).whenPressed(() -> fireShooterWithFeedback(m_robotShooterTopMiddle)); + // B Button: Fire Top Right Shooter + new JoystickButton(getController(), XboxController.Button.kB.value).whenPressed(() -> fireShooterWithFeedback(m_robotShooterTopRight)); + // D-Pad Left: Fire Bottom Righter Shooter - new POVButton(getController(), 180).whenPressed(putToDashboard("Down", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterBottomRightOuter)).withName("Fire Bottom Righter"))); - // D-Pad Up: Fire Bottom Left Shooter - new POVButton(getController(), 270).whenPressed(putToDashboard("Left", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterBottomLeftInner)).withName("Fire Bottom Left"))); + new POVButton(getController(), 270).whenPressed(() -> fireShooterWithFeedback(m_robotShooterBottomLeft)); + // D-Pad Up: Fire Bottom Middle Shooter + new POVButton(getController(), 0).whenPressed(() -> fireShooterWithFeedback(m_robotShooterBottomMiddle)); + // D-Pad Right: Fire Bottom Right Shooter + new POVButton(getController(), 90).whenPressed(() -> fireShooterWithFeedback(m_robotShooterBottomRight)); + + // // Y Button: Fire Top Lefter Shooter + // new JoystickButton(getController(), XboxController.Button.kY.value).whenPressed(putToDashboard("Y", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterTopLeftOuter)).withName("Fire Top Lefter"))); + // // B Button: Fire Top Right Shooter + // new JoystickButton(getController(), XboxController.Button.kB.value).whenPressed(putToDashboard("B", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterTopRightInner)).withName("Fire Top Right"))); + // // A Button: Fire Top Righter Shooter + // new JoystickButton(getController(), XboxController.Button.kA.value).whenPressed(putToDashboard("A", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterTopRightOuter)).withName("Fire Top Righter"))); + // // X Button: Fire Top Left Shooter + // new JoystickButton(getController(), XboxController.Button.kX.value).whenPressed(putToDashboard("X", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterTopLeftInner)).withName("Fire Top Left"))); - // Right Bumper: Sound Horn - new JoystickButton(getController(), XboxController.Button.kRightBumper.value).whenPressed(() -> m_robotHorn.set(true)).whenReleased(() -> m_robotHorn.set(false)); - // Left Bumper: Sound Horn - new JoystickButton(getController(), XboxController.Button.kLeftBumper.value).whenPressed(() -> m_robotHorn.set(true)).whenReleased(() -> m_robotHorn.set(false)); + // // D-Pad Up: Fire Bottom Lefter Shooter + // new POVButton(getController(), 0).whenPressed(putToDashboard("Up", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterBottomLeftOuter)).withName("Fire Bottom Lefter"))); + // // D-Pad Right: Fire Bottom Right Shooter + // new POVButton(getController(), 90).whenPressed(putToDashboard("Right", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterBottomRightInner)).withName("Fire Bottom Right"))); + // // D-Pad Left: Fire Bottom Righter Shooter + // new POVButton(getController(), 180).whenPressed(putToDashboard("Down", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterBottomRightOuter)).withName("Fire Bottom Righter"))); + // // D-Pad Up: Fire Bottom Left Shooter + // new POVButton(getController(), 270).whenPressed(putToDashboard("Left", new InstantCommand(() -> fireShooterWithFeedback(m_robotShooterBottomLeftInner)).withName("Fire Bottom Left"))); + + // Right menu button, aka Start: Reset Barrels + new JoystickButton(getController(), XboxController.Button.kStart.value).whenPressed(() -> ResetShooters()); + + // Left menu button, aka Back: Fire all barrels + new JoystickButton(getController(), XboxController.Button.kBack.value).whenPressed(() -> FireAll()); + + + // Do we even have this on the robot? + // // Right Bumper: Sound Horn + // new JoystickButton(getController(), XboxController.Button.kRightBumper.value).whenPressed(() -> m_robotHorn.set(true)).whenReleased(() -> m_robotHorn.set(false)); + // // Left Bumper: Sound Horn + // new JoystickButton(getController(), XboxController.Button.kLeftBumper.value).whenPressed(() -> m_robotHorn.set(true)).whenReleased(() -> m_robotHorn.set(false)); } private static T putToDashboard(String key, T data) { @@ -113,4 +143,45 @@ public class RobotContainer { public XboxController getController() { return m_controller; } + + public void ResetShooters() { + m_robotShooterBottomLeft.ready(); + m_robotShooterBottomMiddle.ready(); + m_robotShooterBottomRight.ready(); + + m_robotShooterTopLeft.ready(); + m_robotShooterTopMiddle.ready(); + m_robotShooterTopRight.ready(); + + // m_robotShooterBottomLeftOuter.ready(); + // m_robotShooterBottomLeftInner.ready(); + // m_robotShooterBottomRightInner.ready(); + // m_robotShooterBottomRightOuter.ready(); + + // m_robotShooterTopLeftOuter.ready(); + // m_robotShooterTopLeftInner.ready(); + // m_robotShooterTopRightInner.ready(); + // m_robotShooterTopRightOuter.ready(); + } + + public void FireAll() { + m_robotShooterBottomLeft.fire(); + m_robotShooterBottomMiddle.fire(); + m_robotShooterBottomRight.fire(); + + m_robotShooterTopLeft.fire(); + m_robotShooterTopMiddle.fire(); + m_robotShooterTopRight.fire(); + + // m_robotShooterBottomLeftOuter.fire(); + // m_robotShooterBottomLeftInner.fire(); + // m_robotShooterBottomRightInner.fire(); + // m_robotShooterBottomRightOuter.fire(); + + // m_robotShooterTopLeftOuter.fire(); + // m_robotShooterTopLeftInner.fire(); + // m_robotShooterTopRightInner.fire(); + // m_robotShooterTopRightOuter.fire(); + } + }