|
37 | 37 | import frc.robot.Constants.SHOOT_STATE; |
38 | 38 | import frc.robot.commands.AimbotAuto; |
39 | 39 | import frc.robot.commands.AimbotStatic; |
40 | | -import frc.robot.commands.AimbotTele; |
41 | 40 | import frc.robot.commands.AlignToNoteAuto; |
42 | 41 | import frc.robot.commands.AngleShooter; |
43 | 42 | // import frc.robot.commands.AngleShooterShoot; |
@@ -283,9 +282,10 @@ public RobotContainer() { |
283 | 282 | new InstantCommand(() -> shooter.setFeedersRPM(1000))), |
284 | 283 | Map.entry( |
285 | 284 | SHOOT_STATE.AIMBOT, |
286 | | - new SequentialCommandGroup( |
287 | | - new SetElevatorTarget(0, 1.5, elevator), |
288 | | - new AimbotTele(drive, driveController, shooter, pivot, led))), |
| 285 | + // new SequentialCommandGroup( |
| 286 | + // new SetElevatorTarget(0, 1.5, elevator), |
| 287 | + // new AimbotTele(drive, driveController, shooter, pivot, led))), |
| 288 | + new InstantCommand(() -> shooter.setFeedersRPM(1000))), |
289 | 289 | Map.entry( |
290 | 290 | SHOOT_STATE.AMP, |
291 | 291 | new SequentialCommandGroup( |
@@ -473,12 +473,137 @@ public RobotContainer() { |
473 | 473 | * edu.wpi.first.wpilibj2.command.button.JoystickButton}. |
474 | 474 | */ |
475 | 475 | private void configureButtonBindings() { |
476 | | - driverControls(); |
477 | | - manipControls(); |
478 | | - |
| 476 | + // driverControls(); |
| 477 | + // manipControls(); |
| 478 | + demoControls(); |
479 | 479 | // testControls(); |
480 | 480 | } |
481 | 481 |
|
| 482 | + private void demoControls() { |
| 483 | + drive.setDefaultCommand( |
| 484 | + DriveCommands.joystickDrive( |
| 485 | + drive, |
| 486 | + () -> -driveController.getLeftY(), |
| 487 | + () -> -driveController.getLeftX(), |
| 488 | + () -> -driveController.getRightX(), |
| 489 | + driveLeftBumper, |
| 490 | + manipLeftBumper)); |
| 491 | + |
| 492 | + driveRightBumper.onTrue( |
| 493 | + new SequentialCommandGroup( |
| 494 | + new InstantCommand(() -> climbStateMachine.setClimbState(CLIMB_STATES.NONE)), |
| 495 | + new InstantCommand(() -> trapStateMachine.setTargetState(TRAP_STATES.PIVOT)), |
| 496 | + new SetElevatorTarget(0, 1.5, elevator), |
| 497 | + DriveCommands.intakeCommand( |
| 498 | + drive, |
| 499 | + shooter, |
| 500 | + pivot, |
| 501 | + intake, |
| 502 | + led, |
| 503 | + driveController, |
| 504 | + () -> -driveController.getLeftY(), |
| 505 | + () -> -driveController.getLeftX(), |
| 506 | + () -> -driveController.getRightX(), |
| 507 | + () -> false, |
| 508 | + manipLeftBumper))); |
| 509 | + |
| 510 | + driveRightBumper.onFalse( |
| 511 | + new InstantCommand(() -> led.setState(LED_STATE.BLUE)) |
| 512 | + .andThen(new InstantCommand(() -> intake.changeLEDBoolFalse())) |
| 513 | + .andThen(new InstantCommand(() -> shooter.setFeedersRPM(500))) |
| 514 | + .andThen(new WaitCommand(0.02)) |
| 515 | + .andThen( |
| 516 | + new ConditionalCommand( |
| 517 | + new WaitCommand(0.1), |
| 518 | + new WaitCommand(0.06), |
| 519 | + () -> (shooter.getLastNoteState() == NoteState.CURRENT))) |
| 520 | + .andThen( |
| 521 | + new ParallelCommandGroup( |
| 522 | + new InstantCommand(() -> intake.stopRollers(), intake), |
| 523 | + new InstantCommand(() -> shooter.stopFeeders()), |
| 524 | + new SetPivotTarget(Constants.PivotConstants.STOW_SETPOINT_DEG, pivot)) |
| 525 | + .andThen(new PositionNoteInFeeder(shooter, intake)))); |
| 526 | + |
| 527 | + driveStartButton.onTrue( |
| 528 | + Commands.runOnce( |
| 529 | + () -> |
| 530 | + drive.setGyroPose( |
| 531 | + new Pose2d(drive.getPose().getTranslation(), new Rotation2d())), |
| 532 | + drive) |
| 533 | + .ignoringDisable(true)); |
| 534 | + |
| 535 | + driveLeftBumper.onTrue( |
| 536 | + new SequentialCommandGroup( |
| 537 | + new InstantCommand(() -> climbStateMachine.setClimbState(CLIMB_STATES.NONE)), |
| 538 | + new InstantCommand(() -> trapStateMachine.setTargetState(TRAP_STATES.PIVOT)), |
| 539 | + new SetElevatorTarget(0, 1.5, elevator), |
| 540 | + DriveCommands.intakeCommand( |
| 541 | + drive, |
| 542 | + shooter, |
| 543 | + pivot, |
| 544 | + intake, |
| 545 | + led, |
| 546 | + driveController, |
| 547 | + () -> -driveController.getLeftY(), |
| 548 | + () -> -driveController.getLeftX(), |
| 549 | + () -> -driveController.getRightX(), |
| 550 | + () -> true, |
| 551 | + manipLeftBumper))); |
| 552 | + driveLeftBumper.onFalse( |
| 553 | + new InstantCommand(() -> led.setState(LED_STATE.BLUE)) |
| 554 | + .andThen(new InstantCommand(() -> intake.changeLEDBoolFalse())) |
| 555 | + .andThen(new InstantCommand(() -> shooter.setFeedersRPM(500))) |
| 556 | + .andThen(new WaitCommand(0.02)) |
| 557 | + .andThen( |
| 558 | + new ConditionalCommand( |
| 559 | + new WaitCommand(0.1), |
| 560 | + new WaitCommand(0.06), |
| 561 | + () -> (shooter.getLastNoteState() == NoteState.CURRENT))) |
| 562 | + .andThen( |
| 563 | + new ParallelCommandGroup( |
| 564 | + new InstantCommand(() -> intake.stopRollers(), intake), |
| 565 | + new InstantCommand(() -> shooter.stopFeeders()), |
| 566 | + new SetPivotTarget(Constants.PivotConstants.STOW_SETPOINT_DEG, pivot)) |
| 567 | + .andThen(new PositionNoteInFeeder(shooter, intake)))); |
| 568 | + |
| 569 | + driveLeftTrigger.whileTrue(new PivotIntakeTele(pivot, intake, shooter, led, true, false)); |
| 570 | + driveLeftTrigger.onFalse( |
| 571 | + new InstantCommand(intake::stopRollers) |
| 572 | + .andThen(new SetPivotTarget(Constants.PivotConstants.STOW_SETPOINT_DEG, pivot)) |
| 573 | + .andThen(new InstantCommand(() -> shooter.stopFeeders()))); |
| 574 | + |
| 575 | + driveRightTrigger.onTrue(shootCommands); |
| 576 | + driveRightTrigger.onFalse( |
| 577 | + new InstantCommand(() -> shooter.stopFeeders(), shooter) |
| 578 | + .andThen(new InstantCommand(() -> led.setState(LED_STATE.BLUE))) |
| 579 | + .andThen(new SetPivotTarget(Constants.PivotConstants.STOW_SETPOINT_DEG, pivot)) |
| 580 | + .andThen( |
| 581 | + new SetElevatorTarget( |
| 582 | + Constants.ElevatorConstants.RETRACT_SETPOINT_INCH, |
| 583 | + Constants.ElevatorConstants.THRESHOLD, |
| 584 | + elevator)) |
| 585 | + .andThen(new WaitCommand(0.5)) |
| 586 | + .andThen(new InstantCommand(shooter::stopFlywheels)) |
| 587 | + .andThen(new InstantCommand(() -> shooter.turnOffFan(), shooter))); |
| 588 | + |
| 589 | + driveController |
| 590 | + .b() |
| 591 | + .onTrue( |
| 592 | + new SequentialCommandGroup( |
| 593 | + new InstantCommand(() -> climbStateMachine.setClimbState(CLIMB_STATES.NONE)), |
| 594 | + new InstantCommand(() -> trapStateMachine.setTargetState(TRAP_STATES.PIVOT)), |
| 595 | + new SetElevatorTarget(0, 1.5, elevator), |
| 596 | + new InstantCommand(() -> pivot.setShootState(SHOOT_STATE.PIVOT_PRESET)), |
| 597 | + new SetPivotTarget(45, pivot), |
| 598 | + new InstantCommand(() -> shooter.setFlywheelRPMs(2000, 2300)))); |
| 599 | + driveController |
| 600 | + .b() |
| 601 | + .onFalse( |
| 602 | + new InstantCommand(() -> led.setState(LED_STATE.BLUE)) |
| 603 | + .andThen(new InstantCommand(() -> shooter.stopFlywheels())) |
| 604 | + .andThen(new SetPivotTarget(Constants.PivotConstants.STOW_SETPOINT_DEG, pivot))); |
| 605 | + } |
| 606 | + |
482 | 607 | private void testControls() { |
483 | 608 | drive.setDefaultCommand( |
484 | 609 | DriveCommands.joystickDrive( |
@@ -560,6 +685,8 @@ private void testControls() { |
560 | 685 | new InstantCommand(() -> elevator.setConstraints(30, 85)), |
561 | 686 | new InstantCommand(() -> shooter.stopFlywheels(), shooter), |
562 | 687 | new SetPivotTarget(Constants.PivotConstants.STOW_SETPOINT_DEG, pivot)))); |
| 688 | + |
| 689 | + driveAButton.onTrue(climbCommands); |
563 | 690 | } |
564 | 691 |
|
565 | 692 | private void driverControls() { |
|
0 commit comments