Skip to content

Commit

Permalink
update trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
Wu-Fan-529 committed Nov 25, 2024
1 parent 9ef10b2 commit 8fb6464
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class RobotContainer {
m_driverController.axis_LeftY, m_driverController.btn_LeftBumper);

private final Trigger hasGamePieceTrigger = new Trigger(subStager::getHasGP);
private final Trigger isGPDetectedTrigger = new Trigger(subHopper::getGamePieceHopper);

// Drive
public RobotContainer() {
Expand All @@ -50,7 +51,7 @@ private void configureBindings() {
.whileTrue(Commands.deferredProxy(
() -> subStateMachine.tryState(RobotState.INTAKE_GROUND)))
.onFalse(Commands.deferredProxy(
() -> subStateMachine.tryState(RobotState.HAS_GP))
() -> subStateMachine.tryState(RobotState.NONE))
.unless(hasGamePieceTrigger));

// PrepShooter
Expand All @@ -59,11 +60,9 @@ private void configureBindings() {
() -> subStateMachine.tryState(RobotState.PREP_SHOOTER)));

// IntakeHopper
m_driverController.btn_B
.whileTrue(Commands.deferredProxy(
() -> subStateMachine.tryState(RobotState.INTAKE_HOPPER)))
.onFalse(Commands.deferredProxy(
() -> subStateMachine.tryState(RobotState.NONE)));
isGPDetectedTrigger
.onTrue(Commands.deferredProxy(
() -> subStateMachine.tryState(RobotState.INTAKE_HOPPER)));

// EjectShooter
m_driverController.btn_RightBumper
Expand All @@ -89,10 +88,15 @@ private void configureBindings() {

// prepShooter -> hasGP
if (subStateMachine.getState() == RobotState.PREP_SHOOTER) {
m_driverController.btn_X
m_driverController.btn_North
.onTrue(Commands.deferredProxy(
() -> subStateMachine.tryState(RobotState.HAS_GP)));
}

// hasGP
hasGamePieceTrigger
.onTrue(Commands.deferredProxy(
() -> subStateMachine.tryState(RobotState.HAS_GP)));
}

}

Expand Down

0 comments on commit 8fb6464

Please sign in to comment.