1
1
package frc .robot .robot_manager ;
2
2
3
+ import edu .wpi .first .wpilibj .DriverStation ;
3
4
import frc .robot .arm .ArmState ;
4
5
import frc .robot .arm .ArmSubsystem ;
5
6
import frc .robot .imu .ImuSubsystem ;
@@ -26,6 +27,8 @@ public class RobotManager extends StateMachine<RobotState> {
26
27
private final double distanceToFeedSpot = 0.0 ;
27
28
private final double distanceToSpeaker = 0.0 ;
28
29
30
+ private boolean confirmShotActive = false ;
31
+
29
32
public RobotManager (
30
33
ArmSubsystem arm ,
31
34
ShooterSubsystem shooter ,
@@ -58,7 +61,8 @@ protected RobotState getNextState(RobotState currentState) {
58
61
IDLE_WITH_GP ,
59
62
CLIMBING_1_LINEUP ,
60
63
CLIMBING_2_HANGING ,
61
- PODIUM_WAITING ->
64
+ PODIUM_WAITING ,
65
+ OUTTAKING ->
62
66
currentState ;
63
67
case SPEAKER_SCORING ,
64
68
AMP_SCORING ,
@@ -69,7 +73,7 @@ protected RobotState getNextState(RobotState currentState) {
69
73
queuer .hasNote () ? currentState : RobotState .IDLE_NO_GP ;
70
74
71
75
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 ;
73
77
74
78
case AMP_PREPARE_TO_SCORE ->
75
79
shooter .atGoal () && arm .atGoal () ? RobotState .AMP_SCORING : currentState ;
@@ -85,7 +89,6 @@ protected RobotState getNextState(RobotState currentState) {
85
89
86
90
case UNJAM -> currentState ;
87
91
case INTAKING -> queuer .hasNote () ? RobotState .IDLE_WITH_GP : currentState ;
88
- case OUTTAKING -> queuer .hasNote () ? currentState : RobotState .IDLE_NO_GP ;
89
92
};
90
93
}
91
94
@@ -227,8 +230,18 @@ public void robotPeriodic() {
227
230
}
228
231
}
229
232
233
+ public void setConfirmShotActive (boolean newValue ) {
234
+ confirmShotActive = newValue ;
235
+
236
+ }
237
+ public boolean getConfirmShotActive (){
238
+ return confirmShotActive ;
239
+
240
+ }
241
+
230
242
public void confirmShotRequest () {
231
243
switch (getState ()) {
244
+
232
245
case CLIMBING_1_LINEUP , CLIMBING_2_HANGING -> {}
233
246
234
247
case AMP_WAITING -> setStateFromRequest (RobotState .AMP_PREPARE_TO_SCORE );
@@ -270,6 +283,9 @@ public void unjamRequest() {
270
283
public void intakeRequest () {
271
284
switch (getState ()) {
272
285
case CLIMBING_1_LINEUP , CLIMBING_2_HANGING -> {}
286
+ case IDLE_WITH_GP ->{if (!queuer .hasNote ()){
287
+ setStateFromRequest (RobotState .INTAKING );
288
+ }}
273
289
default -> setStateFromRequest (RobotState .INTAKING );
274
290
}
275
291
}
0 commit comments