36
36
import frc .robot .utils .led .SlidePattern ;
37
37
import frc .robot .utils .led .SolidPattern ;
38
38
import java .util .List ;
39
+ import java .util .concurrent .atomic .AtomicBoolean ;
39
40
import java .util .function .DoubleSupplier ;
40
41
41
42
/**
@@ -75,6 +76,8 @@ public class RobotContainer {
75
76
private final ListenableSendableChooser <Command > driveCommandChooser =
76
77
new ListenableSendableChooser <>();
77
78
79
+ private final AtomicBoolean signalHumanPlayer = new AtomicBoolean (false );
80
+
78
81
public RobotContainer () {
79
82
configureDriverBindings ();
80
83
configureOperatorBindings ();
@@ -87,16 +90,44 @@ public RobotContainer() {
87
90
}
88
91
89
92
private void configureLEDs () {
93
+ // Default state for homing lights
94
+ ledSubsystem .setStatusLight (0 , Color .kRed );
95
+ ledSubsystem .setStatusLight (1 , Color .kRed );
96
+
97
+ // Set homing lights to state
98
+ new Trigger (slapdownSuperstructure .getSlapdownRotationSubsystem ()::isHomed ).onFalse (
99
+ Commands .runOnce (() -> {
100
+ ledSubsystem .setStatusLight (0 , Color .kRed );
101
+ }).ignoringDisable (true ).withName ("SlapdownLEDStatusFalse" )
102
+ ).onTrue (
103
+ Commands .runOnce (() -> {
104
+ ledSubsystem .setStatusLight (0 , Color .kGreen );
105
+ }).ignoringDisable (true ).withName ("SlapdownLEDStatusTrue" )
106
+ );
107
+ new Trigger (elevatorSubsystem ::isHomed ).onFalse (
108
+ Commands .runOnce (() -> {
109
+ ledSubsystem .setStatusLight (1 , Color .kRed );
110
+ }).ignoringDisable (true ).withName ("ElevatorLEDStatusFalse" )
111
+ ).onTrue (
112
+ Commands .runOnce (() -> {
113
+ ledSubsystem .setStatusLight (1 , Color .kGreen );
114
+ }).ignoringDisable (true ).withName ("ElevatorLEDStatusTrue" )
115
+ );
116
+
90
117
List <LEDState > ledStates =
91
118
List .of (
119
+ new LEDState (
120
+ signalHumanPlayer ::get ,
121
+ new AlternatePattern (0.5 , Color .kOrange , Color .kBlack )),
92
122
// Red blink if we have any faults
93
123
new LEDState (
94
124
() -> Alert .getDefaultGroup ().hasAnyErrors (),
95
125
new AlternatePattern (2.0 , Color .kRed , Color .kBlack )),
126
+ // Green if we can go under the stage
96
127
new LEDState (
97
128
() ->
98
129
DriverStation .isTeleopEnabled ()
99
- && elevatorSubsystem .atBottomLimit ()
130
+ && elevatorSubsystem .atBottom ()
100
131
&& wristSubsystem .atBottom (),
101
132
new SolidPattern (Color .kGreen )),
102
133
// Default disabled pattern
@@ -129,9 +160,14 @@ private void configureDriverBindings() {
129
160
.whileTrue (
130
161
Commands .parallel (
131
162
IntakingCommands .intakeUntilDetected (
132
- intakeSubsystem , slapdownSuperstructure , transportSubsystem )));
133
- driverController .rightTrigger ().onFalse (slapdownSuperstructure .setUpCommand ());
163
+ intakeSubsystem , slapdownSuperstructure , transportSubsystem ))).onFalse (
164
+ slapdownSuperstructure .setUpCommand ()
165
+ );
134
166
driverController .circle ().whileTrue (new LockModulesCommand (driveSubsystem ).repeatedly ());
167
+
168
+ driverController .a ().onTrue (Commands .runOnce (() -> signalHumanPlayer .set (true ))).onFalse (
169
+ Commands .sequence (Commands .waitSeconds (1.5 ), Commands .runOnce (() -> signalHumanPlayer .set (false )))
170
+ );
135
171
}
136
172
137
173
private void configureOperatorBindings () {
@@ -140,7 +176,7 @@ private void configureOperatorBindings() {
140
176
.onTrue (
141
177
Commands .parallel (
142
178
ScoringCommands .shootSetpointAmpCommand (shooterSubsystem ),
143
- transportSubsystem .setVoltageCommand (12 )));
179
+ transportSubsystem .setVoltageCommand (10 )));
144
180
operatorController
145
181
.triangle ()
146
182
.onTrue (
0 commit comments