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 ;
31- import frc .robot .commands .robotState .AutoScoreReefCommand ;
32+ import frc .robot .commands .robotState .AutoReefCycleCommand ;
3233import frc .robot .commands .robotState .FloorAlgaeCommand ;
3334import frc .robot .commands .robotState .HPAlgaeCommand ;
3435import frc .robot .commands .robotState .InterruptAutoCommand ;
3536import frc .robot .commands .robotState .ReefCycleCommand ;
3637import frc .robot .commands .robotState .ScoreAlgaeCommand ;
3738import frc .robot .commands .robotState .SetScoreSideRightCommand ;
38- import frc .robot .commands .robotState .SetScoreSideCommand ;
3939import frc .robot .commands .robotState .SetScoringLevelCommand ;
4040import frc .robot .commands .robotState .StowCommand ;
41- import frc .robot .commands .tagAlign .TagAlignCommand ;
4241import frc .robot .commands .robotState .ToggleAlgaeHeightCommand ;
4342import frc .robot .commands .robotState .ToggleAutoCommand ;
4443import frc .robot .commands .robotState .ToggleGetAlgaeCommand ;
6766import frc .robot .subsystems .led .LEDIO ;
6867import frc .robot .subsystems .led .LEDSubsystem ;
6968import frc .robot .subsystems .robotState .RobotStateSubsystem ;
70- import frc .robot .subsystems .robotState .RobotStateSubsystem .ScoreSide ;
7169import frc .robot .subsystems .robotState .RobotStateSubsystem .ScoringLevel ;
7270import frc .robot .subsystems .tagAlign .TagAlignSubsystem ;
7371import frc .robot .subsystems .vision .VisionSubsystem ;
@@ -177,12 +175,6 @@ private void configureTelemetry() {
177175 }
178176
179177 private void configureDriverBindings () {
180- // Auto score testing
181- new JoystickButton (driveJoystick , Button .M_RTRIM_UP .id )
182- .onTrue (
183- new AutoScoreReefCommand (
184- robotStateSubsystem , elevatorSubsystem , coralSubsystem , driveSubsystem ));
185-
186178 driveSubsystem .setDefaultCommand (
187179 new DriveTeleopCommand (
188180 () -> flysky .getFwd (), () -> flysky .getStr (), () -> flysky .getYaw (), driveSubsystem ));
@@ -192,10 +184,18 @@ private void configureDriverBindings() {
192184 new JoystickButton (driveJoystick , Button .SWD .id )
193185 .onTrue (
194186 new StowCommand (
195- robotStateSubsystem , elevatorSubsystem , coralSubsystem , biscuitSubsystem ))
187+ robotStateSubsystem ,
188+ elevatorSubsystem ,
189+ coralSubsystem ,
190+ biscuitSubsystem ,
191+ algaeSubsystem ))
196192 .onFalse (
197193 new StowCommand (
198- robotStateSubsystem , elevatorSubsystem , coralSubsystem , biscuitSubsystem ));
194+ robotStateSubsystem ,
195+ elevatorSubsystem ,
196+ coralSubsystem ,
197+ biscuitSubsystem ,
198+ algaeSubsystem ));
199199 new JoystickButton (driveJoystick , Button .SWA .id )
200200 .onTrue (new InterruptAutoCommand (robotStateSubsystem ))
201201 .onFalse (new InterruptAutoCommand (robotStateSubsystem ));
@@ -207,14 +207,26 @@ private void configureDriverBindings() {
207207 .onFalse (new ZeroElevatorCommand (elevatorSubsystem ));
208208
209209 // other stuff
210+
210211 new JoystickButton (driveJoystick , Button .M_SWH .id )
211212 .onTrue (
212- new ReefCycleCommand (
213- robotStateSubsystem ,
214- elevatorSubsystem ,
215- coralSubsystem ,
216- biscuitSubsystem ,
217- 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+
218230 new JoystickButton (driveJoystick , Button .M_SWE .id )
219231 .onTrue (
220232 new ScoreAlgaeCommand (
@@ -236,10 +248,6 @@ private void configureDriverBindings() {
236248 }
237249
238250 private void configureOperatorBindings () {
239- // Auto align testing!
240- new JoystickButton (xboxController , XboxController .Button .kA .value )
241- .onTrue (new TagAlignCommand (tagAlignSubsystem , driveSubsystem ));
242-
243251 // Set Levels
244252 new Trigger (() -> xboxController .getLeftTriggerAxis () > RobotConstants .kTriggerDeadband )
245253 .onTrue (new SetScoringLevelCommand (robotStateSubsystem , ScoringLevel .L1 ));
@@ -251,16 +259,44 @@ private void configureOperatorBindings() {
251259 .onTrue (new SetScoringLevelCommand (robotStateSubsystem , ScoringLevel .L4 ));
252260
253261 // Set scoring side
254- new JoystickButton (xboxController , XboxController .Button .kLeftStick .value )
255- .onTrue (new SetScoreSideCommand (robotStateSubsystem , ScoreSide .LEFT ));
256- new JoystickButton (xboxController , XboxController .Button .kRightStick .value )
257- .onTrue (new SetScoreSideCommand (robotStateSubsystem , ScoreSide .RIGHT ));
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+
267+ // Move biscuit
268+ new Trigger ((() -> xboxController .getRightY () < -RobotConstants .kTestingDeadband ))
269+ .onTrue (
270+ new JogBiscuitCommand (
271+ biscuitSubsystem , Angle .ofBaseUnits (BiscuitConstants .kJogAmountUp , Rotations )))
272+ .onFalse (new HoldBiscuitCommand (biscuitSubsystem ));
273+ new Trigger ((() -> xboxController .getRightY () > RobotConstants .kTestingDeadband ))
274+ .onTrue (
275+ new JogBiscuitCommand (
276+ biscuitSubsystem , Angle .ofBaseUnits (BiscuitConstants .kJogAmountDown , Rotations )))
277+ .onFalse (new HoldBiscuitCommand (biscuitSubsystem ));
278+
279+ // Move elevator
280+ new Trigger ((() -> xboxController .getLeftY () < -RobotConstants .kTestingDeadband ))
281+ .onTrue (
282+ new JogElevatorCommand (
283+ elevatorSubsystem , Angle .ofBaseUnits (ElevatorConstants .kJogAmountUp , Rotations )))
284+ .onFalse (new HoldElevatorCommand (elevatorSubsystem ));
285+ new Trigger ((() -> xboxController .getLeftY () > RobotConstants .kTestingDeadband ))
286+ .onTrue (
287+ new JogElevatorCommand (
288+ elevatorSubsystem , Angle .ofBaseUnits (ElevatorConstants .kJogAmountDown , Rotations )))
289+ .onFalse (new HoldElevatorCommand (elevatorSubsystem ));
258290
259291 // Stow
260292 new JoystickButton (xboxController , XboxController .Button .kBack .value )
261293 .onTrue (
262294 new StowCommand (
263- robotStateSubsystem , elevatorSubsystem , coralSubsystem , biscuitSubsystem ));
295+ robotStateSubsystem ,
296+ elevatorSubsystem ,
297+ coralSubsystem ,
298+ biscuitSubsystem ,
299+ algaeSubsystem ));
264300
265301 // Algae
266302 new JoystickButton (xboxController , XboxController .Button .kY .value )
0 commit comments