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

Commit c455b1b

Browse files
committed
prepare to score logic change
1 parent cc3e026 commit c455b1b

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private void configureBindings() {
160160
.driverController
161161
.rightTrigger()
162162
.onTrue(robotCommands.confirmShotCommand())
163-
.onFalse(robotCommands.waitSpeakerCommand());
163+
;
164164
hardware.driverController.leftTrigger().onTrue(robotCommands.intakeCommand());
165165

166166
hardware
@@ -181,8 +181,8 @@ private void configureBindings() {
181181
hardware
182182
.driverController
183183
.x()
184-
.onTrue(robotCommands.subwooferCommand())
185-
.onFalse(robotCommands.stopShootingCommand());
184+
//TODO:snap
185+
.onFalse(robotCommands.waitSubwooferCommand());
186186
hardware.driverController.b().onTrue(robotCommands.waitAmpCommand());
187187

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

src/main/java/frc/robot/config/CompConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class CompConfig {
156156
speakerDistanceToAngle.put(123.0, 321.0);
157157
},
158158
-77.0,
159-
90.0),
159+
87.0),
160160
new VisionConfig(4, 0.4, 0.4, InterpolatedVisionDataset.HOME));
161161

162162
// NOT TUNED

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
public class RobotCommands {
99
private final RobotManager robot;
1010
private final Subsystem[] requirements;
11+
1112

1213
public RobotCommands(RobotManager robot) {
1314
this.robot = robot;
@@ -66,8 +67,10 @@ public Command waitSpeakerCommand() {
6667
}
6768

6869
public Command confirmShotCommand() {
70+
6971
return Commands.runOnce(robot::confirmShotRequest, requirements)
7072
.andThen(robot.waitForState(RobotState.IDLE_NO_GP));
73+
7174
}
7275

7376
public Command ampCommand() {

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

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package frc.robot.robot_manager;
22

3+
import edu.wpi.first.wpilibj.DriverStation;
34
import frc.robot.arm.ArmState;
45
import frc.robot.arm.ArmSubsystem;
56
import frc.robot.imu.ImuSubsystem;
@@ -26,6 +27,8 @@ public class RobotManager extends StateMachine<RobotState> {
2627
private final double distanceToFeedSpot = 0.0;
2728
private final double distanceToSpeaker = 0.0;
2829

30+
private boolean confirmShotActive = false;
31+
2932
public RobotManager(
3033
ArmSubsystem arm,
3134
ShooterSubsystem shooter,
@@ -58,7 +61,8 @@ protected RobotState getNextState(RobotState currentState) {
5861
IDLE_WITH_GP,
5962
CLIMBING_1_LINEUP,
6063
CLIMBING_2_HANGING,
61-
PODIUM_WAITING ->
64+
PODIUM_WAITING,
65+
OUTTAKING ->
6266
currentState;
6367
case SPEAKER_SCORING,
6468
AMP_SCORING,
@@ -69,7 +73,7 @@ protected RobotState getNextState(RobotState currentState) {
6973
queuer.hasNote() ? currentState : RobotState.IDLE_NO_GP;
7074

7175
case SPEAKER_PREPARE_TO_SCORE ->
72-
shooter.atGoal() && arm.atGoal() ? RobotState.SPEAKER_SCORING : currentState;
76+
shooter.atGoal() && arm.atGoal() && if(DriverStation.isTeleop()){getConfirmShotActive()==true} ? RobotState.SPEAKER_SCORING : currentState;
7377

7478
case AMP_PREPARE_TO_SCORE ->
7579
shooter.atGoal() && arm.atGoal() ? RobotState.AMP_SCORING : currentState;
@@ -85,7 +89,6 @@ protected RobotState getNextState(RobotState currentState) {
8589

8690
case UNJAM -> currentState;
8791
case INTAKING -> queuer.hasNote() ? RobotState.IDLE_WITH_GP : currentState;
88-
case OUTTAKING -> queuer.hasNote() ? currentState : RobotState.IDLE_NO_GP;
8992
};
9093
}
9194

@@ -227,8 +230,18 @@ public void robotPeriodic() {
227230
}
228231
}
229232

233+
public void setConfirmShotActive(boolean newValue) {
234+
confirmShotActive = newValue;
235+
236+
}
237+
public boolean getConfirmShotActive(){
238+
return confirmShotActive;
239+
240+
}
241+
230242
public void confirmShotRequest() {
231243
switch (getState()) {
244+
232245
case CLIMBING_1_LINEUP, CLIMBING_2_HANGING -> {}
233246

234247
case AMP_WAITING -> setStateFromRequest(RobotState.AMP_PREPARE_TO_SCORE);
@@ -270,6 +283,9 @@ public void unjamRequest() {
270283
public void intakeRequest() {
271284
switch (getState()) {
272285
case CLIMBING_1_LINEUP, CLIMBING_2_HANGING -> {}
286+
case IDLE_WITH_GP->{if(!queuer.hasNote()){
287+
setStateFromRequest(RobotState.INTAKING);
288+
}}
273289
default -> setStateFromRequest(RobotState.INTAKING);
274290
}
275291
}

0 commit comments

Comments
 (0)