From 3df83555a4388ddd12d174a33d63e1386821a9b0 Mon Sep 17 00:00:00 2001 From: suryatho Date: Wed, 6 Mar 2024 23:28:10 -0500 Subject: [PATCH] Only allow coast when override is switched during disable --- .../littletonrobotics/frc2024/RobotContainer.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/littletonrobotics/frc2024/RobotContainer.java b/src/main/java/org/littletonrobotics/frc2024/RobotContainer.java index 1fea6bd4..20cfb92e 100644 --- a/src/main/java/org/littletonrobotics/frc2024/RobotContainer.java +++ b/src/main/java/org/littletonrobotics/frc2024/RobotContainer.java @@ -117,6 +117,7 @@ public class RobotContainer { private boolean podiumShotMode = false; private boolean trapScoreMode = true; + private boolean coastOverride = false; // Dashboard inputs private final LoggedDashboardChooser autoChooser = @@ -257,9 +258,17 @@ public RobotContainer() { superstructure = new Superstructure(arm, climber, backpackActuator); // Set up subsystems - arm.setOverrides(armDisable, armCoast); + // Set up coast override + armCoast + .and(DriverStation::isDisabled) + .onTrue(Commands.runOnce(() -> coastOverride = true).ignoringDisable(true)); + armCoast + .negate() + .or(DriverStation::isEnabled) + .onTrue(Commands.runOnce(() -> coastOverride = false).ignoringDisable(true)); + arm.setOverrides(armDisable, () -> coastOverride); + climber.setCoastOverride(() -> coastOverride); RobotState.getInstance().setLookaheadDisable(lookaheadDisable); - climber.setCoastOverride(armCoast); flywheels.setPrepareShootSupplier( () -> { return DriverStation.isTeleopEnabled()