@@ -31,6 +31,7 @@ public class RobotContainer {
3131 private final Trigger hasGamePieceTrigger = new Trigger (subStager ::getHasGP );
3232 private final Trigger isGPDetectedTrigger = new Trigger (subHopper ::getGamePieceHopper );
3333
34+
3435 // Drive
3536 public RobotContainer () {
3637 subDrivetrain .setDefaultCommand (com_Drive );
@@ -46,7 +47,7 @@ private void configureBindings() {
4647 () -> subStateMachine .tryState (RobotState .INTAKE_GROUND )))
4748 .onFalse (Commands .deferredProxy (
4849 () -> subStateMachine .tryState (RobotState .NONE ))
49- .unless ( isGPDetectedTrigger ));
50+ .onlyIf ( subStateMachine :: desiredIsCurrent ));
5051
5152 // PrepShooter
5253 m_driverController .btn_A
@@ -63,34 +64,33 @@ private void configureBindings() {
6364 .whileTrue (Commands .deferredProxy (
6465 () -> subStateMachine .tryState (RobotState .EJECT_SHOOTER )))
6566 .onFalse (Commands .deferredProxy (
66- () -> subStateMachine .tryState (RobotState .NONE )));
67+ () -> subStateMachine .tryState (RobotState .NONE )). onlyIf ( subStateMachine :: desiredIsCurrent ) );
6768
6869 // EjectIntake
6970 m_driverController .btn_LeftBumper
7071 .whileTrue (Commands .deferredProxy (
7172 () -> subStateMachine .tryState (RobotState .EJECT_INTAKE )))
7273 .onFalse (Commands .deferredProxy (
73- () -> subStateMachine .tryState (RobotState .NONE )));
74+ () -> subStateMachine .tryState (RobotState .NONE )). onlyIf ( subStateMachine :: desiredIsCurrent ) );
7475
7576 // Shoot
7677 m_driverController .btn_RightTrigger
7778 .onTrue (Commands .deferredProxy (
7879 () -> subStateMachine .tryState (RobotState .SHOOT )))
7980 .onFalse (Commands .deferredProxy (
80- () -> subStateMachine .tryState (RobotState .NONE )));
81-
81+ () -> subStateMachine .tryState (RobotState .NONE )).onlyIf (subStateMachine ::desiredIsCurrent ) );
8282
8383 // hasGP
84-
85- hasGamePieceTrigger
86- .whileTrue (Commands .deferredProxy (
87- () -> subStateMachine .tryState (RobotState .HAS_GP )));
8884
89- //StopShooter
85+ hasGamePieceTrigger
86+ .whileTrue (Commands .deferredProxy (
87+ () -> subStateMachine .tryState (RobotState .HAS_GP )));
88+
89+ // StopShooter
9090 m_driverController .btn_X
91- .onTrue (Commands .deferredProxy (
92- () -> subStateMachine .tryState (RobotState .STOP_SHOOTER ) ));
93-
91+ .onTrue (Commands .deferredProxy (
92+ () -> subStateMachine .tryState (RobotState .STOP_SHOOTER )));
93+
9494 }
9595
9696 public Command getAutonomousCommand () {
0 commit comments