1212import edu .wpi .first .wpilibj .shuffleboard .Shuffleboard ;
1313import edu .wpi .first .wpilibj2 .command .Command ;
1414import edu .wpi .first .wpilibj2 .command .Commands ;
15+ import edu .wpi .first .wpilibj2 .command .ConditionalCommand ;
1516import edu .wpi .first .wpilibj2 .command .button .JoystickButton ;
1617import edu .wpi .first .wpilibj2 .command .button .Trigger ;
1718import frc .robot .commands .algae .IntakeAlgaeCommand ;
2829import frc .robot .commands .elevator .JogElevatorCommand ;
2930import frc .robot .commands .elevator .SetElevatorPositionCommand ;
3031import frc .robot .commands .elevator .ZeroElevatorCommand ;
32+ import frc .robot .commands .robotState .AutoReefCycleCommand ;
3133import frc .robot .commands .robotState .FloorAlgaeCommand ;
3234import frc .robot .commands .robotState .HPAlgaeCommand ;
3335import frc .robot .commands .robotState .InterruptAutoCommand ;
@@ -182,10 +184,18 @@ private void configureDriverBindings() {
182184 new JoystickButton (driveJoystick , Button .SWD .id )
183185 .onTrue (
184186 new StowCommand (
185- robotStateSubsystem , elevatorSubsystem , coralSubsystem , biscuitSubsystem ))
187+ robotStateSubsystem ,
188+ elevatorSubsystem ,
189+ coralSubsystem ,
190+ biscuitSubsystem ,
191+ algaeSubsystem ))
186192 .onFalse (
187193 new StowCommand (
188- robotStateSubsystem , elevatorSubsystem , coralSubsystem , biscuitSubsystem ));
194+ robotStateSubsystem ,
195+ elevatorSubsystem ,
196+ coralSubsystem ,
197+ biscuitSubsystem ,
198+ algaeSubsystem ));
189199 new JoystickButton (driveJoystick , Button .SWA .id )
190200 .onTrue (new InterruptAutoCommand (robotStateSubsystem ))
191201 .onFalse (new InterruptAutoCommand (robotStateSubsystem ));
@@ -197,14 +207,26 @@ private void configureDriverBindings() {
197207 .onFalse (new ZeroElevatorCommand (elevatorSubsystem ));
198208
199209 // other stuff
210+
200211 new JoystickButton (driveJoystick , Button .M_SWH .id )
201212 .onTrue (
202- new ReefCycleCommand (
203- robotStateSubsystem ,
204- elevatorSubsystem ,
205- coralSubsystem ,
206- biscuitSubsystem ,
207- algaeSubsystem ));
213+ new ConditionalCommand (
214+ new AutoReefCycleCommand (
215+ robotStateSubsystem ,
216+ elevatorSubsystem ,
217+ coralSubsystem ,
218+ driveSubsystem ,
219+ tagAlignSubsystem ,
220+ biscuitSubsystem ,
221+ algaeSubsystem ),
222+ new ReefCycleCommand (
223+ robotStateSubsystem ,
224+ elevatorSubsystem ,
225+ coralSubsystem ,
226+ biscuitSubsystem ,
227+ algaeSubsystem ),
228+ () -> robotStateSubsystem .getIsAutoPlacing ()));
229+
208230 new JoystickButton (driveJoystick , Button .M_SWE .id )
209231 .onTrue (
210232 new ScoreAlgaeCommand (
@@ -226,6 +248,22 @@ private void configureDriverBindings() {
226248 }
227249
228250 private void configureOperatorBindings () {
251+ // Set Levels
252+ new Trigger (() -> xboxController .getLeftTriggerAxis () > RobotConstants .kTriggerDeadband )
253+ .onTrue (new SetScoringLevelCommand (robotStateSubsystem , ScoringLevel .L1 ));
254+ new JoystickButton (xboxController , XboxController .Button .kLeftBumper .value )
255+ .onTrue (new SetScoringLevelCommand (robotStateSubsystem , ScoringLevel .L2 ));
256+ new JoystickButton (xboxController , XboxController .Button .kRightBumper .value )
257+ .onTrue (new SetScoringLevelCommand (robotStateSubsystem , ScoringLevel .L3 ));
258+ new Trigger (() -> xboxController .getRightTriggerAxis () > RobotConstants .kTriggerDeadband )
259+ .onTrue (new SetScoringLevelCommand (robotStateSubsystem , ScoringLevel .L4 ));
260+
261+ // Set scoring side
262+ // new JoystickButton(xboxController, XboxController.Button.kLeftStick.value)
263+ // .onTrue(new SetScoreSideCommand(robotStateSubsystem, ScoreSide.LEFT));
264+ // new JoystickButton(xboxController, XboxController.Button.kRightStick.value)
265+ // .onTrue(new SetScoreSideCommand(robotStateSubsystem, ScoreSide.RIGHT));
266+
229267 // Move biscuit
230268 new Trigger ((() -> xboxController .getRightY () < -RobotConstants .kTestingDeadband ))
231269 .onTrue (
@@ -250,21 +288,15 @@ private void configureOperatorBindings() {
250288 elevatorSubsystem , Angle .ofBaseUnits (ElevatorConstants .kJogAmountDown , Rotations )))
251289 .onFalse (new HoldElevatorCommand (elevatorSubsystem ));
252290
253- // Set Levels
254- new Trigger (() -> xboxController .getLeftTriggerAxis () > RobotConstants .kTriggerDeadband )
255- .onTrue (new SetScoringLevelCommand (robotStateSubsystem , ScoringLevel .L1 ));
256- new JoystickButton (xboxController , XboxController .Button .kLeftBumper .value )
257- .onTrue (new SetScoringLevelCommand (robotStateSubsystem , ScoringLevel .L2 ));
258- new JoystickButton (xboxController , XboxController .Button .kRightBumper .value )
259- .onTrue (new SetScoringLevelCommand (robotStateSubsystem , ScoringLevel .L3 ));
260- new Trigger (() -> xboxController .getRightTriggerAxis () > RobotConstants .kTriggerDeadband )
261- .onTrue (new SetScoringLevelCommand (robotStateSubsystem , ScoringLevel .L4 ));
262-
263291 // Stow
264292 new JoystickButton (xboxController , XboxController .Button .kBack .value )
265293 .onTrue (
266294 new StowCommand (
267- robotStateSubsystem , elevatorSubsystem , coralSubsystem , biscuitSubsystem ));
295+ robotStateSubsystem ,
296+ elevatorSubsystem ,
297+ coralSubsystem ,
298+ biscuitSubsystem ,
299+ algaeSubsystem ));
268300
269301 // Algae
270302 new JoystickButton (xboxController , XboxController .Button .kY .value )
@@ -400,4 +432,8 @@ public void configurePitDashboard() {
400432 public Command getAutonomousCommand () {
401433 return Commands .print ("No autonomous command configured" );
402434 }
435+
436+ public void stopTagAlign () {
437+ tagAlignSubsystem .terminate ();
438+ }
403439}
0 commit comments