From 633f28e2ffbea35b61ff494286c9fc9153cff82f Mon Sep 17 00:00:00 2001 From: Nate Laverdure Date: Sat, 15 Aug 2026 17:01:57 -0400 Subject: [PATCH] Fix launcher not disabling off the field, add aim for fallback drivers The launcher's default command had regressed back to unconditionally initializing the hood and aiming (from #533cacc), silently undoing the #97 fix that let the Zorro left dial disable the launcher when off the FMS. Restore the default command to stop the launcher so the dial (and FMS-attached override) are the only things that turn it on. That default previously masked a gap in the Xbox and keyboard driver bindings, which have no dial and never explicitly enabled the launcher. Give them an always-true trigger so the launcher aims unconditionally whenever either is the active driver, matching the FMS-attached behavior on the Zorro path. --- src/main/java/frc/robot/Robot.java | 42 ++++++++++++++++-------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/main/java/frc/robot/Robot.java b/src/main/java/frc/robot/Robot.java index 1dcfcba..4305007 100644 --- a/src/main/java/frc/robot/Robot.java +++ b/src/main/java/frc/robot/Robot.java @@ -316,13 +316,7 @@ public Robot() { feeder.setDefaultCommand(Commands.startEnd(feeder::stop, () -> {}, feeder).withName("Stop")); intake.setDefaultCommand(intake.getDefaultCommand()); launcher.setDefaultCommand( - launcher - .initializeHoodCommand() - .andThen( - new RunCommand( - () -> launcher.aim(GameState.getTarget(drive.getPose()).getTranslation()), - launcher) - .withName("Aim at hub"))); + Commands.startEnd(launcher::stop, () -> {}, launcher).withName("Stop")); } /** This function is called periodically during all modes. */ @@ -541,20 +535,10 @@ public boolean getFieldRelativeInput() { // Desaturate turret and advance feeder zorroDriver.AIn(loop).whileTrue(createDesaturateAndShootCommand(controller)); - // Launcher + // Launcher: dial-enabled off the field, always on once connected to the FMS Trigger launcherEnabled = zorroDriver.axisGreaterThan(Axis.kLeftDial.value, 0.5, loop).debounce(0.1); - launcherEnabled - .or(() -> DriverStation.isFMSAttached()) - .whileTrue( - launcher - .initializeHoodCommand() - .andThen( - new RunCommand( - () -> - launcher.aim(GameState.getTarget(drive.getPose()).getTranslation()), - launcher) - .withName("Aim at hub"))); + launcherEnabled.or(() -> DriverStation.isFMSAttached()).whileTrue(aimAtHubCommand()); // Intake zorroDriver.HIn(loop).whileTrue(intake.getDeployCommand()); @@ -562,6 +546,20 @@ public boolean getFieldRelativeInput() { return controller; } + /** + * Builds the launcher's "aim at hub" command: initializes the hood, then continuously tracks the + * hub target. Requires the launcher subsystem. + */ + private Command aimAtHubCommand() { + return launcher + .initializeHoodCommand() + .andThen( + new RunCommand( + () -> launcher.aim(GameState.getTarget(drive.getPose()).getTranslation()), + launcher) + .withName("Aim at hub")); + } + public DriverController bindXboxDriver(int port, EventLoop loop) { var xboxDriver = new CommandXboxController(port); @@ -672,6 +670,9 @@ public boolean getFieldRelativeInput() { // Intake xboxDriver.rightBumper(loop).whileTrue(intake.getDeployCommand()); + // Launcher: no dial to gate it on this controller, so aim unconditionally + new Trigger(loop, () -> true).whileTrue(aimAtHubCommand()); + return controller; } @@ -718,6 +719,9 @@ public boolean getFieldRelativeInput() { .onTrue( Commands.runOnce(() -> DriveCommands.resetDriverForward(drive)).ignoringDisable(true)); + // Launcher: no dial to gate it on this controller, so aim unconditionally + new Trigger(loop, () -> true).whileTrue(aimAtHubCommand()); + return controller; }