99import edu .wpi .first .units .measure .Angle ;
1010import edu .wpi .first .wpilibj .Joystick ;
1111import edu .wpi .first .wpilibj .XboxController ;
12+ import edu .wpi .first .wpilibj .shuffleboard .Shuffleboard ;
1213import edu .wpi .first .wpilibj2 .command .Command ;
1314import edu .wpi .first .wpilibj2 .command .Commands ;
1415import edu .wpi .first .wpilibj2 .command .button .JoystickButton ;
1516import edu .wpi .first .wpilibj2 .command .button .Trigger ;
17+ import frc .robot .commands .algae .IntakeAlgaeCommand ;
1618import frc .robot .commands .algae .OpenLoopAlgaeCommand ;
19+ import frc .robot .commands .algae .ProcessorAlgaeCommand ;
20+ import frc .robot .commands .algae .ToggleHasAlgaeCommand ;
21+ import frc .robot .commands .biscuit .HoldBiscuitCommand ;
22+ import frc .robot .commands .biscuit .JogBiscuitCommand ;
1723import frc .robot .commands .coral .EnableEjectBeamCommand ;
1824import frc .robot .commands .coral .OpenLoopCoralCommand ;
1925import frc .robot .commands .drive .DriveTeleopCommand ;
2329import frc .robot .commands .elevator .SetElevatorPositionCommand ;
2430import frc .robot .commands .elevator .ZeroElevatorCommand ;
2531import frc .robot .commands .robotState .AutoScoreReefCommand ;
26- import frc .robot .commands .robotState .ScoreReefManualCommand ;
32+ import frc .robot .commands .robotState .FloorAlgaeCommand ;
33+ import frc .robot .commands .robotState .HPAlgaeCommand ;
34+ import frc .robot .commands .robotState .InterruptAutoCommand ;
35+ import frc .robot .commands .robotState .ReefCycleCommand ;
36+ import frc .robot .commands .robotState .ScoreAlgaeCommand ;
37+ import frc .robot .commands .robotState .SetScoreSideRightCommand ;
2738import frc .robot .commands .robotState .SetScoreSideCommand ;
2839import frc .robot .commands .robotState .SetScoringLevelCommand ;
2940import frc .robot .commands .robotState .StowCommand ;
3041import frc .robot .commands .tagAlign .TagAlignCommand ;
42+ import frc .robot .commands .robotState .ToggleAlgaeHeightCommand ;
43+ import frc .robot .commands .robotState .ToggleAutoCommand ;
44+ import frc .robot .commands .robotState .ToggleGetAlgaeCommand ;
45+ import frc .robot .commands .robotState .setScoreSideLeftCommand ;
46+ import frc .robot .constants .BiscuitConstants ;
3147import frc .robot .constants .ElevatorConstants ;
3248import frc .robot .constants .RobotConstants ;
3349import frc .robot .controllers .FlyskyJoystick ;
@@ -146,6 +162,8 @@ public RobotContainer() {
146162 configureTelemetry ();
147163 configureDriverBindings ();
148164 configureOperatorBindings ();
165+ // configureTestOperatorBindings();
166+ configurePitDashboard ();
149167 }
150168
151169 private void configureTelemetry () {
@@ -154,6 +172,7 @@ private void configureTelemetry() {
154172 algaeSubsystem .registerWith (telemetryService );
155173 elevatorSubsystem .registerWith (telemetryService );
156174 funnelSubsystem .registerWith (telemetryService );
175+ biscuitSubsystem .registerWith (telemetryService );
157176 telemetryService .start ();
158177 }
159178
@@ -168,10 +187,52 @@ private void configureDriverBindings() {
168187 new DriveTeleopCommand (
169188 () -> flysky .getFwd (), () -> flysky .getStr (), () -> flysky .getYaw (), driveSubsystem ));
170189
171- // Reset Gyro Command
190+ // Reset Gyro Command, stow, interrupt Auton, and zero elev
172191 new JoystickButton (driveJoystick , Button .M_SWC .id ).onTrue (new ResetGyroCommand (driveSubsystem ));
192+ new JoystickButton (driveJoystick , Button .SWD .id )
193+ .onTrue (
194+ new StowCommand (
195+ robotStateSubsystem , elevatorSubsystem , coralSubsystem , biscuitSubsystem ))
196+ .onFalse (
197+ new StowCommand (
198+ robotStateSubsystem , elevatorSubsystem , coralSubsystem , biscuitSubsystem ));
199+ new JoystickButton (driveJoystick , Button .SWA .id )
200+ .onTrue (new InterruptAutoCommand (robotStateSubsystem ))
201+ .onFalse (new InterruptAutoCommand (robotStateSubsystem ));
202+ new JoystickButton (driveJoystick , Button .SWB_UP .id )
203+ .onTrue (new ZeroElevatorCommand (elevatorSubsystem ))
204+ .onFalse (new ZeroElevatorCommand (elevatorSubsystem ));
205+ new JoystickButton (driveJoystick , Button .SWB_DWN .id )
206+ .onTrue (new ZeroElevatorCommand (elevatorSubsystem ))
207+ .onFalse (new ZeroElevatorCommand (elevatorSubsystem ));
208+
209+ // other stuff
173210 new JoystickButton (driveJoystick , Button .M_SWH .id )
174- .onTrue (new ScoreReefManualCommand (robotStateSubsystem , elevatorSubsystem , coralSubsystem ));
211+ .onTrue (
212+ new ReefCycleCommand (
213+ robotStateSubsystem ,
214+ elevatorSubsystem ,
215+ coralSubsystem ,
216+ biscuitSubsystem ,
217+ algaeSubsystem ));
218+ new JoystickButton (driveJoystick , Button .M_SWE .id )
219+ .onTrue (
220+ new ScoreAlgaeCommand (
221+ robotStateSubsystem , elevatorSubsystem , biscuitSubsystem , algaeSubsystem ));
222+ new JoystickButton (driveJoystick , Button .SWF_UP .id )
223+ .onTrue (
224+ new FloorAlgaeCommand (
225+ robotStateSubsystem , elevatorSubsystem , biscuitSubsystem , algaeSubsystem ))
226+ .onFalse (
227+ new FloorAlgaeCommand (
228+ robotStateSubsystem , elevatorSubsystem , biscuitSubsystem , algaeSubsystem ));
229+ new JoystickButton (driveJoystick , Button .SWF_DWN .id )
230+ .onTrue (
231+ new FloorAlgaeCommand (
232+ robotStateSubsystem , elevatorSubsystem , biscuitSubsystem , algaeSubsystem ))
233+ .onFalse (
234+ new FloorAlgaeCommand (
235+ robotStateSubsystem , elevatorSubsystem , biscuitSubsystem , algaeSubsystem ));
175236 }
176237
177238 private void configureOperatorBindings () {
@@ -201,12 +262,56 @@ private void configureOperatorBindings() {
201262 new StowCommand (
202263 robotStateSubsystem , elevatorSubsystem , coralSubsystem , biscuitSubsystem ));
203264
204- // zero elevator, slated for removal
265+ // Algae
266+ new JoystickButton (xboxController , XboxController .Button .kY .value )
267+ .onTrue (new ToggleAlgaeHeightCommand (robotStateSubsystem ));
205268 new JoystickButton (xboxController , XboxController .Button .kX .value )
206- .onTrue (new ZeroElevatorCommand (elevatorSubsystem ));
269+ .onTrue (new ToggleGetAlgaeCommand (robotStateSubsystem ));
270+ new JoystickButton (xboxController , XboxController .Button .kB .value )
271+ .onTrue (
272+ new HPAlgaeCommand (
273+ robotStateSubsystem , elevatorSubsystem , biscuitSubsystem , algaeSubsystem ));
274+
275+ // Scoring
276+ new JoystickButton (xboxController , XboxController .Button .kA .value )
277+ .onTrue (new ToggleAutoCommand (robotStateSubsystem ));
278+
279+ new JoystickButton (xboxController , XboxController .Button .kRightStick .value )
280+ .onTrue (new SetScoreSideRightCommand (robotStateSubsystem ));
281+ new JoystickButton (xboxController , XboxController .Button .kLeftStick .value )
282+ .onTrue (new setScoreSideLeftCommand (robotStateSubsystem ));
207283 }
208284
209285 private void configureTestOperatorBindings () {
286+ new JoystickButton (xboxController , XboxController .Button .kLeftBumper .value )
287+ .onTrue (new IntakeAlgaeCommand (algaeSubsystem ));
288+ new JoystickButton (xboxController , XboxController .Button .kRightBumper .value )
289+ .onTrue (new ProcessorAlgaeCommand (algaeSubsystem ));
290+
291+ // Move biscuit
292+ new Trigger ((() -> xboxController .getRightY () < -RobotConstants .kTestingDeadband ))
293+ .onTrue (
294+ new JogBiscuitCommand (
295+ biscuitSubsystem , Angle .ofBaseUnits (BiscuitConstants .kJogAmountUp , Rotations )))
296+ .onFalse (new HoldBiscuitCommand (biscuitSubsystem ));
297+ new Trigger ((() -> xboxController .getRightY () > RobotConstants .kTestingDeadband ))
298+ .onTrue (
299+ new JogBiscuitCommand (
300+ biscuitSubsystem , Angle .ofBaseUnits (BiscuitConstants .kJogAmountDown , Rotations )))
301+ .onFalse (new HoldBiscuitCommand (biscuitSubsystem ));
302+
303+ // Move elevator
304+ new Trigger ((() -> xboxController .getLeftY () < -RobotConstants .kTestingDeadband ))
305+ .onTrue (
306+ new JogElevatorCommand (
307+ elevatorSubsystem , Angle .ofBaseUnits (ElevatorConstants .kJogAmountUp , Rotations )))
308+ .onFalse (new HoldElevatorCommand (elevatorSubsystem ));
309+ new Trigger ((() -> xboxController .getLeftY () > RobotConstants .kTestingDeadband ))
310+ .onTrue (
311+ new JogElevatorCommand (
312+ elevatorSubsystem , Angle .ofBaseUnits (ElevatorConstants .kJogAmountDown , Rotations )))
313+ .onFalse (new HoldElevatorCommand (elevatorSubsystem ));
314+
210315 // Stop Coral
211316 new JoystickButton (xboxController , XboxController .Button .kB .value )
212317 .onTrue (new OpenLoopCoralCommand (coralSubsystem , 0 ));
@@ -221,13 +326,25 @@ private void configureTestOperatorBindings() {
221326 .onTrue (new OpenLoopCoralCommand (coralSubsystem , 1 ))
222327 .onTrue (new EnableEjectBeamCommand (false , coralSubsystem ));
223328
224- // Move Elevator
329+ // Move biscuit
225330 new Trigger ((() -> xboxController .getRightY () < -RobotConstants .kTestingDeadband ))
331+ .onTrue (
332+ new JogBiscuitCommand (
333+ biscuitSubsystem , Angle .ofBaseUnits (BiscuitConstants .kJogAmountUp , Rotations )))
334+ .onFalse (new HoldBiscuitCommand (biscuitSubsystem ));
335+ new Trigger ((() -> xboxController .getRightY () > RobotConstants .kTestingDeadband ))
336+ .onTrue (
337+ new JogBiscuitCommand (
338+ biscuitSubsystem , Angle .ofBaseUnits (BiscuitConstants .kJogAmountDown , Rotations )))
339+ .onFalse (new HoldBiscuitCommand (biscuitSubsystem ));
340+
341+ // Move elevator
342+ new Trigger ((() -> xboxController .getLeftY () < -RobotConstants .kTestingDeadband ))
226343 .onTrue (
227344 new JogElevatorCommand (
228345 elevatorSubsystem , Angle .ofBaseUnits (ElevatorConstants .kJogAmountUp , Rotations )))
229346 .onFalse (new HoldElevatorCommand (elevatorSubsystem ));
230- new Trigger ((() -> xboxController .getRightY () > RobotConstants .kTestingDeadband ))
347+ new Trigger ((() -> xboxController .getLeftY () > RobotConstants .kTestingDeadband ))
231348 .onTrue (
232349 new JogElevatorCommand (
233350 elevatorSubsystem , Angle .ofBaseUnits (ElevatorConstants .kJogAmountDown , Rotations )))
@@ -263,6 +380,19 @@ private void configureTestOperatorBindings() {
263380 new SetElevatorPositionCommand (elevatorSubsystem , ElevatorConstants .kL4CoralSetpoint ));
264381 }
265382
383+ public void configurePitDashboard () {
384+
385+ Shuffleboard .getTab ("Pit" )
386+ .add ("Toggle Has Algae" , new ToggleHasAlgaeCommand (algaeSubsystem ))
387+ .withPosition (3 , 2 )
388+ .withSize (1 , 1 );
389+
390+ Shuffleboard .getTab ("Pit" )
391+ .add ("Zero Elevator" , new ZeroElevatorCommand (elevatorSubsystem ))
392+ .withPosition (2 , 1 )
393+ .withSize (1 , 1 );
394+ }
395+
266396 public Command getAutonomousCommand () {
267397 return Commands .print ("No autonomous command configured" );
268398 }
0 commit comments