|
7 | 7 | import com.ctre.phoenix6.hardware.Pigeon2; |
8 | 8 | import com.ctre.phoenix6.swerve.SwerveDrivetrain.SwerveDriveState; |
9 | 9 | import com.pathplanner.lib.auto.AutoBuilder; |
| 10 | +import com.pathplanner.lib.auto.NamedCommands; |
10 | 11 | import com.pathplanner.lib.commands.FollowPathCommand; |
11 | | - |
12 | 12 | import edu.wpi.first.epilogue.Logged; |
13 | | -import edu.wpi.first.util.sendable.Sendable; |
14 | 13 | import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; |
15 | 14 | import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; |
16 | 15 | import edu.wpi.first.wpilibj2.command.Command; |
@@ -40,21 +39,54 @@ public class RobotContainer { |
40 | 39 | Commands.parallel( |
41 | 40 | new KickerCommand(kicker, KickerCommand.Position.INTAKE), |
42 | 41 | Commands.runEnd( |
43 | | - () -> hopper.slowMove(HopperConfig.HOPPER_RETRACT_ROTATION), |
44 | | - () -> hopper.stop(), |
45 | | - hopper).withDeadline(Commands.waitSeconds(2)), |
| 42 | + () -> hopper.slowMove(HopperConfig.HOPPER_RETRACT_ROTATION), |
| 43 | + () -> hopper.stop(), |
| 44 | + hopper) |
| 45 | + .withDeadline(Commands.waitSeconds(2)), |
46 | 46 | new IntakeCommand(intake, IntakeCommand.Position.SLOW_INTAKE)) |
47 | 47 | .finallyDo( |
48 | 48 | interrupt -> |
49 | 49 | CommandScheduler.getInstance() |
50 | 50 | .schedule( |
51 | 51 | Commands.runEnd( |
52 | | - () -> hopper.move(HopperConfig.HOPPER_EXTEND_ROTATION), |
53 | | - () -> hopper.stop(), |
54 | | - hopper).withDeadline(Commands.waitSeconds(2)))); |
| 52 | + () -> hopper.move(HopperConfig.HOPPER_EXTEND_ROTATION), |
| 53 | + () -> hopper.stop(), |
| 54 | + hopper) |
| 55 | + .withDeadline(Commands.waitSeconds(2)))); |
55 | 56 |
|
56 | 57 | public RobotContainer() { |
57 | | - autoChooser = AutoBuilder.buildAutoChooser("Test"); |
| 58 | + NamedCommands.registerCommand( |
| 59 | + "idle", |
| 60 | + Commands.runOnce(() -> hopper.stop(), hopper) |
| 61 | + .alongWith(Commands.runOnce(() -> intake.stop(), intake)) |
| 62 | + .alongWith(Commands.runOnce(() -> kicker.stop(), kicker))); |
| 63 | + |
| 64 | + NamedCommands.registerCommand( |
| 65 | + "hopper deploy", |
| 66 | + Commands.runEnd( |
| 67 | + () -> hopper.move(HopperConfig.HOPPER_EXTEND_ROTATION), () -> hopper.stop(), hopper) |
| 68 | + .alongWith(Commands.run(() -> System.out.println("Hopper Deployed"))) |
| 69 | + .withDeadline(Commands.waitSeconds(2))); |
| 70 | + |
| 71 | + NamedCommands.registerCommand( |
| 72 | + "intake", |
| 73 | + new IntakeCommand(intake, IntakeCommand.Position.INTAKE) |
| 74 | + .withDeadline(Commands.waitSeconds(8))); |
| 75 | + |
| 76 | + NamedCommands.registerCommand( |
| 77 | + "shoot long", |
| 78 | + Commands.parallel( |
| 79 | + new KickerCommand(kicker, KickerCommand.Position.INTAKE), |
| 80 | + Commands.runEnd( |
| 81 | + () -> hopper.slowMove(HopperConfig.HOPPER_RETRACT_ROTATION), |
| 82 | + () -> hopper.stop(), |
| 83 | + hopper) |
| 84 | + .withDeadline(Commands.waitSeconds(2)), |
| 85 | + new IntakeCommand(intake, IntakeCommand.Position.SLOW_INTAKE), |
| 86 | + new FlywheelCommand(flywheel, FlywheelCommand.Position.TRENCH_SHOT, drivetrain)) |
| 87 | + .withDeadline(Commands.waitSeconds(8))); |
| 88 | + |
| 89 | + autoChooser = AutoBuilder.buildAutoChooser("Test"); |
58 | 90 | SmartDashboard.putData("Auto Mode", autoChooser); |
59 | 91 |
|
60 | 92 | configureBindings(); |
@@ -86,9 +118,9 @@ private void configureBindings() { |
86 | 118 | .toggleOnTrue(new IntakeCommand(intake, IntakeCommand.Position.INTAKE)); |
87 | 119 |
|
88 | 120 | controller |
89 | | - .povRight() |
90 | | - .and(() -> !shootGroup.isScheduled()) |
91 | | - .toggleOnTrue(new IntakeCommand(intake, IntakeCommand.Position.OUTTAKE)); |
| 121 | + .povRight() |
| 122 | + .and(() -> !shootGroup.isScheduled()) |
| 123 | + .toggleOnTrue(new IntakeCommand(intake, IntakeCommand.Position.OUTTAKE)); |
92 | 124 | // Right Stick Down = Extend/Retract Hopper |
93 | 125 | controller |
94 | 126 | .rightStick() |
|
0 commit comments