Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Commit 6ecb3ce

Browse files
committed
button bindings
1 parent af39a4d commit 6ecb3ce

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

src/main/java/frc/robot/Robot.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ private void configureBindings() {
156156
}
157157
}));
158158

159-
hardware.driverController.rightTrigger().onTrue(robotCommands.confirmShotCommand());
159+
hardware
160+
.driverController
161+
.rightTrigger()
162+
.onTrue(robotCommands.confirmShotCommand())
163+
.onFalse(robotCommands.stopShootingCommand());
160164
hardware.driverController.leftTrigger().onTrue(robotCommands.intakeCommand());
161165

162166
hardware
@@ -178,7 +182,7 @@ private void configureBindings() {
178182
.driverController
179183
.x()
180184
// TODO:snap
181-
.onFalse(robotCommands.waitSubwooferCommand());
185+
.onTrue(robotCommands.waitSubwooferCommand());
182186
hardware.driverController.b().onTrue(robotCommands.waitAmpCommand());
183187

184188
hardware.driverController.a().onTrue(robotCommands.stowCommand());

src/main/java/frc/robot/robot_manager/RobotCommands.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,15 @@ public Command stopIntakingCommand() {
5151
}
5252

5353
public Command waitSubwooferCommand() {
54-
return Commands.runOnce(robot::waitSubwooferRequest, requirements)
55-
.andThen(robot.waitForState(RobotState.SUBWOOFER_WAITING));
54+
return Commands.runOnce(robot::waitSubwooferRequest, requirements);
5655
}
5756

5857
public Command waitAmpCommand() {
59-
return Commands.runOnce(robot::waitAmpRequest, requirements)
60-
.andThen(robot.waitForState(RobotState.AMP_WAITING));
58+
return Commands.runOnce(robot::waitAmpRequest, requirements);
6159
}
6260

6361
public Command waitSpeakerCommand() {
64-
return Commands.runOnce(robot::waitSpeakerRequest, requirements)
65-
.andThen(robot.waitForState(RobotState.SPEAKER_WAITING));
62+
return Commands.runOnce(robot::waitSpeakerRequest, requirements);
6663
}
6764

6865
public Command confirmShotCommand() {
@@ -86,8 +83,7 @@ public Command feedingCommand() {
8683
}
8784

8885
public Command waitFeedingCommand() {
89-
return Commands.runOnce(robot::waitFeedRequest, requirements)
90-
.andThen(robot.waitForState(RobotState.FEEDING_WAITING));
86+
return Commands.runOnce(robot::waitFeedRequest, requirements);
9187
}
9288

9389
public Command subwooferCommand() {

src/main/java/frc/robot/robot_manager/RobotManager.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,8 @@ protected RobotState getNextState(RobotState currentState) {
7373
queuer.hasNote() ? currentState : RobotState.IDLE_NO_GP;
7474

7575
case SPEAKER_PREPARE_TO_SCORE ->
76-
(shooter.atGoal() && arm.atGoal() && DriverStation.isTeleop() == false)
77-
|| (DriverStation.isTeleop()
78-
&& confirmShotActive == true
79-
&& shooter.atGoal()
80-
&& arm.atGoal())
76+
(shooter.atGoal() && arm.atGoal())
77+
&& (DriverStation.isAutonomous() || confirmShotActive == true)
8178
? RobotState.SPEAKER_SCORING
8279
: currentState;
8380

@@ -241,6 +238,7 @@ public void setConfirmShotActive(boolean newValue) {
241238
}
242239

243240
public void confirmShotRequest() {
241+
setConfirmShotActive(true);
244242
switch (getState()) {
245243
case CLIMBING_1_LINEUP, CLIMBING_2_HANGING -> {}
246244

@@ -284,9 +282,7 @@ public void intakeRequest() {
284282
switch (getState()) {
285283
case CLIMBING_1_LINEUP, CLIMBING_2_HANGING -> {}
286284
case IDLE_WITH_GP -> {
287-
if (!queuer.hasNote()) {
288-
setStateFromRequest(RobotState.INTAKING);
289-
}
285+
setStateFromRequest(RobotState.INTAKING);
290286
}
291287
default -> setStateFromRequest(RobotState.INTAKING);
292288
}
@@ -332,6 +328,7 @@ public void stowRequest() {
332328
setStateFromRequest(RobotState.IDLE_WITH_GP);
333329
default -> setStateFromRequest(RobotState.IDLE_NO_GP);
334330
}
331+
setConfirmShotActive(false);
335332
}
336333

337334
public void preparePassRequest() {
@@ -399,6 +396,7 @@ public void stopShootingRequest() {
399396

400397
default -> setStateFromRequest(RobotState.IDLE_WITH_GP);
401398
}
399+
setConfirmShotActive(false);
402400
}
403401

404402
public void prepareSubwooferRequest() {

0 commit comments

Comments
 (0)