99import edu .wpi .first .wpilibj2 .command .button .CommandXboxController ;
1010import edu .wpi .first .wpilibj2 .command .button .Trigger ;
1111import frc .robot .commands .drive .DriveCommand ;
12+ import frc .robot .commands .pivot .ManualPivot ;
1213import frc .robot .extras .simulation .field .SimulatedField ;
1314import frc .robot .extras .simulation .mechanismSim .swerve .GyroSimulation ;
1415import frc .robot .extras .simulation .mechanismSim .swerve .SwerveDriveSimulation ;
1516import frc .robot .extras .simulation .mechanismSim .swerve .SwerveModuleSimulation ;
1617import frc .robot .extras .simulation .mechanismSim .swerve .SwerveModuleSimulation .WHEEL_GRIP ;
1718import frc .robot .extras .util .JoystickUtil ;
19+ import frc .robot .subsystems .pivot .Pivot ;
20+ import frc .robot .subsystems .pivot .PivotIOSim ;
21+ import frc .robot .subsystems .pivot .PivotIOTalonFX ;
1822import frc .robot .subsystems .swerve .SwerveConstants ;
1923import frc .robot .subsystems .swerve .SwerveConstants .DriveConstants ;
2024import frc .robot .subsystems .swerve .SwerveConstants .ModuleConstants ;
@@ -36,9 +40,10 @@ public class RobotContainer {
3640 private final Vision visionSubsystem ;
3741 private final SwerveDrive swerveDrive ;
3842 private final CommandXboxController operatorController = new CommandXboxController (1 );
43+ // private final Pivot pivot;
3944 // private final Indexer indexer = new Indexer(new IndexerIOTalonFX());
4045 // private final Intake intake = new Intake(new IntakeIOTalonFX());
41- // private final Pivot pivot = new Pivot(new PivotIOTalonFX()) ;
46+ private final Pivot pivot ;
4247 // private final Flywheel flywheel = new Flywheel(new FlywheelIOTalonFX());
4348 private final CommandXboxController driverController = new CommandXboxController (0 );
4449
@@ -51,7 +56,7 @@ public class RobotContainer {
5156 // private final XboxController driverController = new XboxController(0);
5257
5358 public RobotContainer () {
54- switch (Constants .currentMode ) {
59+ switch (Constants .CURRENT_MODE ) {
5560 case REAL -> {
5661 /* Real robot, instantiate hardware IO implementations */
5762
@@ -68,12 +73,14 @@ public RobotContainer() {
6873 new PhysicalModule (SwerveConstants .moduleConfigs [2 ]),
6974 new PhysicalModule (SwerveConstants .moduleConfigs [3 ]));
7075 visionSubsystem = new Vision (new VisionIOReal ());
76+ pivot = new Pivot (new PivotIOTalonFX ());
7177 }
7278
7379 case SIM -> {
7480 /* Sim robot, instantiate physics sim IO implementations */
7581
7682 /* create simulations */
83+ pivot = new Pivot (new PivotIOSim ());
7784 /* create simulation for pigeon2 IMU (different IMUs have different measurement erros) */
7885 this .gyroSimulation = GyroSimulation .createNavX2 ();
7986 /* create a swerve drive simulation */
@@ -128,6 +135,7 @@ public RobotContainer() {
128135 new ModuleInterface () {},
129136 new ModuleInterface () {},
130137 new ModuleInterface () {});
138+ pivot = null ;
131139 }
132140 }
133141 }
@@ -190,7 +198,7 @@ private void configureButtonBindings() {
190198 // Trigger driverRightTrigger = new Trigger(()->driverController.getRightTriggerAxis() > 0.2);
191199
192200 // // manual pivot and intake rollers
193- // Trigger operatorAButton = new Trigger(operatorController::getAButton );
201+ Trigger operatorAButton = new Trigger (operatorController . a () );
194202 // Trigger operatorXButton = new Trigger(operatorController::getXButton);
195203 // Trigger operatorYButton = new Trigger(operatorController::getYButton);
196204 // DoubleSupplier operatorRightStickY = operatorController::getRightY;
@@ -202,7 +210,7 @@ private void configureButtonBindings() {
202210 Trigger driverLeftBumper = new Trigger (driverController .leftBumper ());
203211 // Trigger driverBButton = new Trigger(driverController::getBButton);
204212 // Trigger driverYButton = new Trigger(driverController::getYButton);
205- // DoubleSupplier operatorLeftStickY = operatorController::getLeftY;
213+ DoubleSupplier operatorLeftStickY = operatorController ::getLeftY ;
206214
207215 // //DRIVER BUTTONS
208216
@@ -285,8 +293,8 @@ private void configureButtonBindings() {
285293 // operatorLeftBumper.whileTrue(new TowerIntake(intakeSubsystem, pivotSubsystem,
286294 // shooterSubsystem, true, ledSubsystem, this::intakeCallback));
287295 // // manual pivot (possible climb, unlikely)
288- // operatorAButton.whileTrue(new ManualPivot(pivotSubsystem,
289- // ()-> modifyAxisCubed(operatorRightStickY )));
296+ operatorAButton .whileTrue (
297+ new ManualPivot ( pivot , () -> JoystickUtil . modifyAxisCubed (operatorLeftStickY )));
290298 // operatorDownDirectionPad.whileTrue(new ManualPivot(pivotSubsystem, ()->-0.2));
291299 // // manual rollers
292300 // operatorYButton.whileTrue(new ManualIntake(intakeSubsystem, true));
0 commit comments