From 013cc147c975c8c026a02e2929ff4a1d17ba80de Mon Sep 17 00:00:00 2001 From: Xiaohan Date: Thu, 5 Dec 2024 17:58:22 -0600 Subject: [PATCH 1/2] added ugly swapability --- src/main/java/frc/robot/RobotContainer.java | 145 ++++++++++++++---- .../java/frc/robot/settings/Constants.java | 4 + 2 files changed, 117 insertions(+), 32 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 7410abe..b39c194 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -40,6 +40,7 @@ import frc.robot.settings.Constants.Field; import frc.robot.settings.Constants.IntakeConstants; import frc.robot.settings.Constants.ShooterConstants; +import frc.robot.settings.Constants.Controllers; import frc.robot.subsystems.AngleShooterSubsystem; import frc.robot.subsystems.Climber; import frc.robot.commands.ManualShoot; @@ -73,6 +74,7 @@ import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import edu.wpi.first.wpilibj2.command.button.Trigger; import edu.wpi.first.wpilibj.Preferences; +import edu.wpi.first.wpilibj.XboxController; import edu.wpi.first.wpilibj.DriverStation.Alliance; import edu.wpi.first.wpilibj.PowerDistribution.ModuleType; import edu.wpi.first.math.MathUtil; @@ -96,7 +98,8 @@ public class RobotContainer { // The robot's subsystems and commands are defined here... -// preferences are information saved on the Rio. They are initialized once, then gotten every time we run the code. +private static final int CONTROLLER_IS_XBOX = 0; + // preferences are information saved on the Rio. They are initialized once, then gotten every time we run the code. private final boolean intakeExists = Preferences.getBoolean("Intake", true); private final boolean shooterExists = Preferences.getBoolean("Shooter", true); private final boolean angleShooterExists = Preferences.getBoolean("AngleShooter", true); @@ -114,8 +117,10 @@ public class RobotContainer { private Drive defaultDriveCommand; private Climber climber; private Lights lights; - private PS4Controller driverController; - private PS4Controller operatorController; + private XboxController driverControllerXbox; + private XboxController operatorControllerXbox; + private PS4Controller driverControllerPS4; + private PS4Controller operatorControllerPS4; //private PS4Controller operatorController; private Limelight limelight; private IndexCommand defaulNoteHandlingCommand; @@ -147,6 +152,7 @@ public class RobotContainer { DoubleSupplier zeroSup; BooleanSupplier AutoPickupSup; BooleanSupplier CenterAmpPassSup; + Boolean controllerType; BooleanSupplier intakeReverse; Command autoPickup; @@ -179,28 +185,29 @@ public RobotContainer() { // URCL.start(); // SignalLogger.setPath("/media/sda1/ctre-logs/"); // SignalLogger.start(); - driverController = new PS4Controller(DRIVE_CONTROLLER_ID); - operatorController = new PS4Controller(OPERATOR_CONTROLLER_ID); + + if(controllerType){ + driverControllerXbox = new XboxController(DRIVE_CONTROLLER_ID); + operatorControllerXbox = new XboxController(OPERATOR_CONTROLLER_ID); //operatorController = new PS4Controller(OPERATOs_CONTROLLER_ID); PDP = new PowerDistribution(1, ModuleType.kRev); - ZeroGyroSup = driverController::getPSButton; - ForceVisionSup = driverController::getOptionsButton; - - AimWhileMovingSup = driverController::getL2Button; - HumanPlaySup = driverController::getR1Button; - AmpAngleSup = ()->driverController.getPOV() == 90||driverController.getPOV() == 45||driverController.getPOV() == 135;; - ManualShootSup = driverController::getR2Button; - ClimberDownSup = operatorController::getPSButton; - GroundIntakeSup = driverController::getL1Button; - OperatorRevToZero = ()->operatorController.getPOV() != -1; - SubwooferAngleSup =()-> driverController.getCrossButton()||operatorController.getCrossButton(); - StageAngleSup = ()->operatorController.getTriangleButton()||driverController.getTriangleButton();; - FarStageAngleSup = ()->operatorController.getSquareButton()||driverController.getSquareButton(); - OppositeStageShotSup = ()->operatorController.getCircleButton()||driverController.getCircleButton(); - OverStagePassSup = operatorController::getL1Button; - CenterAmpPassSup = operatorController::getL2Button; - AutoPickupSup = ()->operatorController.getTouchpad()||driverController.getTouchpad(); + ZeroGyroSup = driverControllerXbox::getStartButton; + ForceVisionSup = driverControllerXbox::getRightStickButton; + + AimWhileMovingSup = ()-> driverControllerXbox.getLeftTriggerAxis() >= 0.5; + HumanPlaySup = driverControllerXbox::getLeftBumper; + AmpAngleSup = ()-> driverControllerXbox.getPOV() == 90; + ManualShootSup = ()-> driverControllerXbox.getRightTriggerAxis() >= 0.5; + ClimberDownSup = operatorControllerXbox::getStartButton; + GroundIntakeSup = driverControllerXbox::getRightBumper; + OperatorRevToZero = ()->driverControllerXbox.getRightStickButton() || operatorControllerXbox.getYButton(); + SubwooferAngleSup =()-> driverControllerXbox.getAButton(); + StageAngleSup = ()->driverControllerXbox.getYButton(); + FarStageAngleSup = ()->driverControllerXbox.getXButton(); + OppositeStageShotSup = ()->driverControllerXbox.getBButton(); + OverStagePassSup = ()-> driverControllerXbox.getLeftStickButton(); + AutoPickupSup = ()->driverControllerXbox.getBackButton(); zeroSup = ()->0; falseSup = ()->false; //discontinued buttons: @@ -208,6 +215,38 @@ public RobotContainer() { ShooterUpManualSup = ()->false; ForceVisionSup = ()->false; ShootIfReadySup = ()->false; + } + else if(!controllerType){ + driverControllerPS4 = new PS4Controller(DRIVE_CONTROLLER_ID); + operatorControllerPS4 = new PS4Controller(OPERATOR_CONTROLLER_ID); + //operatorController = new PS4Controller(OPERATOs_CONTROLLER_ID); + PDP = new PowerDistribution(1, ModuleType.kRev); + + ZeroGyroSup = driverControllerPS4::getPSButton; + ForceVisionSup = driverControllerPS4::getOptionsButton; + + AimWhileMovingSup = driverControllerPS4::getL2Button; + HumanPlaySup = driverControllerPS4::getR1Button; + AmpAngleSup = ()->driverControllerPS4.getPOV() == 90||driverControllerPS4.getPOV() == 45||driverControllerPS4.getPOV() == 135;; + ManualShootSup = driverControllerPS4::getR2Button; + ClimberDownSup = operatorControllerPS4::getPSButton; + GroundIntakeSup = driverControllerPS4::getL1Button; + OperatorRevToZero = ()->operatorControllerPS4.getPOV() != -1; + SubwooferAngleSup =()-> driverControllerPS4.getCrossButton()||operatorControllerPS4.getCrossButton(); + StageAngleSup = ()->operatorControllerPS4.getTriangleButton()||driverControllerPS4.getTriangleButton();; + FarStageAngleSup = ()->operatorControllerPS4.getSquareButton()||driverControllerPS4.getSquareButton(); + OppositeStageShotSup = ()->operatorControllerPS4.getCircleButton()||driverControllerPS4.getCircleButton(); + OverStagePassSup = operatorControllerPS4::getL1Button; + CenterAmpPassSup = operatorControllerPS4::getL2Button; + AutoPickupSup = ()->operatorControllerPS4.getTouchpad()||driverControllerPS4.getTouchpad(); + zeroSup = ()->0; + falseSup = ()->false; + //discontinued buttons: + intakeReverse = ()->false; + ShooterUpManualSup = ()->false; + ForceVisionSup = ()->false; + ShootIfReadySup = ()->false; + } // = new PathPlannerPath(null, DEFAUL_PATH_CONSTRAINTS, null, climberExists); limelightInit(); @@ -244,13 +283,24 @@ private void climbSpotChooserInit() { } private void driveTrainInst() { driveTrain = new DrivetrainSubsystem(); + if(controllerType){ + defaultDriveCommand = new Drive( + driveTrain, + () -> false, + () -> modifyAxis(-driverControllerXbox.getRawAxis(Y_AXIS), DEADBAND_NORMAL), + () -> modifyAxis(-driverControllerXbox.getRawAxis(X_AXIS), DEADBAND_NORMAL), + () -> modifyAxis(-driverControllerXbox.getRawAxis(Z_AXIS), DEADBAND_NORMAL)); + driveTrain.setDefaultCommand(defaultDriveCommand); + } + else if(!controllerType){ defaultDriveCommand = new Drive( driveTrain, () -> false, - () -> modifyAxis(-driverController.getRawAxis(Y_AXIS), DEADBAND_NORMAL), - () -> modifyAxis(-driverController.getRawAxis(X_AXIS), DEADBAND_NORMAL), - () -> modifyAxis(-driverController.getRawAxis(Z_AXIS), DEADBAND_NORMAL)); + () -> modifyAxis(-driverControllerPS4.getRawAxis(Y_AXIS), DEADBAND_NORMAL), + () -> modifyAxis(-driverControllerPS4.getRawAxis(X_AXIS), DEADBAND_NORMAL), + () -> modifyAxis(-driverControllerPS4.getRawAxis(Z_AXIS), DEADBAND_NORMAL)); driveTrain.setDefaultCommand(defaultDriveCommand); + } } private void shooterInst() { shooter = new ShooterSubsystem(ShooterConstants.SHOOTER_MOTOR_POWER); @@ -265,12 +315,21 @@ private void intakeInst() { } private void climberInst() { climber = new Climber(); + if(controllerType){ + climber.setDefaultCommand(new ClimberCommand( + climber, + ()-> modifyAxis(operatorControllerXbox.getLeftY(), DEADBAND_NORMAL), + ()-> modifyAxis(operatorControllerXbox.getRightY(), DEADBAND_NORMAL), + ClimberDownSup)); + } + else if(!controllerType){ climber.setDefaultCommand(new ClimberCommand( climber, - ()-> modifyAxis(operatorController.getLeftY(), DEADBAND_NORMAL), - ()-> modifyAxis(operatorController.getRightY(), DEADBAND_NORMAL), + ()-> modifyAxis(operatorControllerPS4.getLeftY(), DEADBAND_NORMAL), + ()-> modifyAxis(operatorControllerPS4.getRightY(), DEADBAND_NORMAL), ClimberDownSup)); } + } private void indexInit() { indexer = new IndexerSubsystem(intakeExists ? RobotState.getInstance()::isNoteSeen : () -> false); } @@ -314,12 +373,28 @@ public boolean runsWhenDisabled() { // new Trigger(driverController::getCrossButton).onTrue(new autoAimParallel(driveTrain/*, shooter*/)); new Trigger(ZeroGyroSup).onTrue(new InstantCommand(driveTrain::zeroGyroscope)); // new Trigger(driverController::getCircleButton).whileTrue(new GoToAmp(driveTrain)); unused becuase we dont pickup from amp with a path anymore + if(controllerType){ + new Trigger(AimWhileMovingSup).whileTrue(new AimRobotMoving( + driveTrain, + () -> modifyAxis(-driverControllerXbox.getRawAxis(Z_AXIS), DEADBAND_NORMAL), + () -> modifyAxis(-driverControllerXbox.getRawAxis(Y_AXIS), DEADBAND_NORMAL), + () -> modifyAxis(-driverControllerXbox.getRawAxis(X_AXIS), DEADBAND_NORMAL), + ()->driverControllerXbox.getLeftTriggerAxis() >= 0.5, + StageAngleSup, + FarStageAngleSup, + SubwooferAngleSup, + OverStagePassSup, + OppositeStageShotSup, + falseSup + )); + } + else if (!controllerType){ new Trigger(AimWhileMovingSup).whileTrue(new AimRobotMoving( driveTrain, - () -> modifyAxis(-driverController.getRawAxis(Z_AXIS), DEADBAND_NORMAL), - () -> modifyAxis(-driverController.getRawAxis(Y_AXIS), DEADBAND_NORMAL), - () -> modifyAxis(-driverController.getRawAxis(X_AXIS), DEADBAND_NORMAL), - driverController::getL2Button, + () -> modifyAxis(-driverControllerPS4.getRawAxis(Z_AXIS), DEADBAND_NORMAL), + () -> modifyAxis(-driverControllerPS4.getRawAxis(Y_AXIS), DEADBAND_NORMAL), + () -> modifyAxis(-driverControllerPS4.getRawAxis(X_AXIS), DEADBAND_NORMAL), + driverControllerPS4::getL2Button, StageAngleSup, FarStageAngleSup, SubwooferAngleSup, @@ -327,6 +402,7 @@ public boolean runsWhenDisabled() { OppositeStageShotSup, falseSup )); + } // new Trigger(()->driverController.getL3Button()&&driverController.getR3Button()).onTrue( // new SequentialCommandGroup( // new InstantCommand(()->angleShooterSubsystem.setDesiredShooterAngle(22.5), angleShooterSubsystem), @@ -376,7 +452,12 @@ public boolean runsWhenDisabled() { SmartDashboard.putData("Manual Angle Shooter Up", new AngleShooter(angleShooterSubsystem, ()->ShooterConstants.PRAC_MAXIMUM_SHOOTER_ANGLE)); } if(indexerExists) { - new Trigger(ManualShootSup).whileTrue(new ManualShoot(indexer, driverController::getPOV, intake)); + if(controllerType){ + new Trigger(ManualShootSup).whileTrue(new ManualShoot(indexer, driverControllerXbox::getPOV, intake)); + } + else if(!controllerType){ + new Trigger(ManualShootSup).whileTrue(new ManualShoot(indexer, driverControllerPS4::getPOV, intake)); + } } if(climberExists) { } diff --git a/src/main/java/frc/robot/settings/Constants.java b/src/main/java/frc/robot/settings/Constants.java index a378e4e..7f9f5a8 100644 --- a/src/main/java/frc/robot/settings/Constants.java +++ b/src/main/java/frc/robot/settings/Constants.java @@ -452,6 +452,10 @@ public final class PS4Operator{ } + public final class Controllers{ + public static final boolean CONTROLLER_IS_XBOX = false; + } + public final class Field{ public static final double ROBOT_CENTER_TO_BUMBER = 0.419; From e52bc451a76fb14d2eeebb9b3044691d323194d4 Mon Sep 17 00:00:00 2001 From: Liam Sykes <2491nomythic@gmail.com> Date: Thu, 12 Dec 2024 19:14:47 -0600 Subject: [PATCH 2/2] fire commit, everything works, fixed bindings to match ps4 controller bindings --- src/main/java/frc/robot/RobotContainer.java | 142 +++++++++--------- .../java/frc/robot/settings/Constants.java | 4 - 2 files changed, 70 insertions(+), 76 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index b39c194..3a5377a 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -40,7 +40,6 @@ import frc.robot.settings.Constants.Field; import frc.robot.settings.Constants.IntakeConstants; import frc.robot.settings.Constants.ShooterConstants; -import frc.robot.settings.Constants.Controllers; import frc.robot.subsystems.AngleShooterSubsystem; import frc.robot.subsystems.Climber; import frc.robot.commands.ManualShoot; @@ -97,8 +96,6 @@ */ public class RobotContainer { // The robot's subsystems and commands are defined here... - -private static final int CONTROLLER_IS_XBOX = 0; // preferences are information saved on the Rio. They are initialized once, then gotten every time we run the code. private final boolean intakeExists = Preferences.getBoolean("Intake", true); private final boolean shooterExists = Preferences.getBoolean("Shooter", true); @@ -109,6 +106,7 @@ public class RobotContainer { private final boolean sideWheelsExists = Preferences.getBoolean("IntakeSideWheels", true); //private final boolean autosExist = Preferences.getBoolean("Autos", true); private final boolean useDetectorLimelight = Preferences.getBoolean("Detector Limelight", true); + private final boolean useXboxController = Preferences.getBoolean("Xbox Controller", true); private DrivetrainSubsystem driveTrain; private IntakeSubsystem intake; @@ -152,7 +150,6 @@ public class RobotContainer { DoubleSupplier zeroSup; BooleanSupplier AutoPickupSup; BooleanSupplier CenterAmpPassSup; - Boolean controllerType; BooleanSupplier intakeReverse; Command autoPickup; @@ -176,6 +173,7 @@ public RobotContainer() { Preferences.initBoolean("Detector Limelight", false); Preferences.initBoolean("Use Limelight", true); Preferences.initBoolean("Use 2 Limelights", true); + Preferences.initBoolean("Xbox Controller", true); Preferences.initDouble("wait # of seconds", 0); DataLogManager.start(); //Start logging @@ -186,66 +184,66 @@ public RobotContainer() { // SignalLogger.setPath("/media/sda1/ctre-logs/"); // SignalLogger.start(); - if(controllerType){ - driverControllerXbox = new XboxController(DRIVE_CONTROLLER_ID); - operatorControllerXbox = new XboxController(OPERATOR_CONTROLLER_ID); - //operatorController = new PS4Controller(OPERATOs_CONTROLLER_ID); - PDP = new PowerDistribution(1, ModuleType.kRev); - - ZeroGyroSup = driverControllerXbox::getStartButton; - ForceVisionSup = driverControllerXbox::getRightStickButton; - - AimWhileMovingSup = ()-> driverControllerXbox.getLeftTriggerAxis() >= 0.5; - HumanPlaySup = driverControllerXbox::getLeftBumper; - AmpAngleSup = ()-> driverControllerXbox.getPOV() == 90; - ManualShootSup = ()-> driverControllerXbox.getRightTriggerAxis() >= 0.5; - ClimberDownSup = operatorControllerXbox::getStartButton; - GroundIntakeSup = driverControllerXbox::getRightBumper; - OperatorRevToZero = ()->driverControllerXbox.getRightStickButton() || operatorControllerXbox.getYButton(); - SubwooferAngleSup =()-> driverControllerXbox.getAButton(); - StageAngleSup = ()->driverControllerXbox.getYButton(); - FarStageAngleSup = ()->driverControllerXbox.getXButton(); - OppositeStageShotSup = ()->driverControllerXbox.getBButton(); - OverStagePassSup = ()-> driverControllerXbox.getLeftStickButton(); - AutoPickupSup = ()->driverControllerXbox.getBackButton(); - zeroSup = ()->0; - falseSup = ()->false; - //discontinued buttons: - intakeReverse = ()->false; - ShooterUpManualSup = ()->false; - ForceVisionSup = ()->false; - ShootIfReadySup = ()->false; - } - else if(!controllerType){ - driverControllerPS4 = new PS4Controller(DRIVE_CONTROLLER_ID); - operatorControllerPS4 = new PS4Controller(OPERATOR_CONTROLLER_ID); - //operatorController = new PS4Controller(OPERATOs_CONTROLLER_ID); - PDP = new PowerDistribution(1, ModuleType.kRev); - - ZeroGyroSup = driverControllerPS4::getPSButton; - ForceVisionSup = driverControllerPS4::getOptionsButton; - - AimWhileMovingSup = driverControllerPS4::getL2Button; - HumanPlaySup = driverControllerPS4::getR1Button; - AmpAngleSup = ()->driverControllerPS4.getPOV() == 90||driverControllerPS4.getPOV() == 45||driverControllerPS4.getPOV() == 135;; - ManualShootSup = driverControllerPS4::getR2Button; - ClimberDownSup = operatorControllerPS4::getPSButton; - GroundIntakeSup = driverControllerPS4::getL1Button; - OperatorRevToZero = ()->operatorControllerPS4.getPOV() != -1; - SubwooferAngleSup =()-> driverControllerPS4.getCrossButton()||operatorControllerPS4.getCrossButton(); - StageAngleSup = ()->operatorControllerPS4.getTriangleButton()||driverControllerPS4.getTriangleButton();; - FarStageAngleSup = ()->operatorControllerPS4.getSquareButton()||driverControllerPS4.getSquareButton(); - OppositeStageShotSup = ()->operatorControllerPS4.getCircleButton()||driverControllerPS4.getCircleButton(); - OverStagePassSup = operatorControllerPS4::getL1Button; - CenterAmpPassSup = operatorControllerPS4::getL2Button; - AutoPickupSup = ()->operatorControllerPS4.getTouchpad()||driverControllerPS4.getTouchpad(); - zeroSup = ()->0; - falseSup = ()->false; - //discontinued buttons: - intakeReverse = ()->false; - ShooterUpManualSup = ()->false; - ForceVisionSup = ()->false; - ShootIfReadySup = ()->false; + if(useXboxController){ + driverControllerXbox = new XboxController(DRIVE_CONTROLLER_ID); + operatorControllerXbox = new XboxController(OPERATOR_CONTROLLER_ID); + //operatorController = new PS4Controller(OPERATOs_CONTROLLER_ID); + PDP = new PowerDistribution(1, ModuleType.kRev); + + ZeroGyroSup = driverControllerXbox::getStartButton; + ForceVisionSup = driverControllerXbox::getRightStickButton; + + AimWhileMovingSup = ()-> driverControllerXbox.getLeftTriggerAxis() >= 0.5; + HumanPlaySup = driverControllerXbox::getRightBumper; + AmpAngleSup = ()-> driverControllerXbox.getPOV() == 90 || driverControllerXbox.getPOV() ==45 || driverControllerXbox.getPOV() == 135 ; + ManualShootSup = ()-> driverControllerXbox.getRightTriggerAxis() >= 0.5; + ClimberDownSup = operatorControllerXbox::getStartButton; + GroundIntakeSup = driverControllerXbox::getLeftBumper; + OperatorRevToZero = ()->operatorControllerXbox.getPOV() != -1; + SubwooferAngleSup =()-> driverControllerXbox.getAButton()||operatorControllerXbox.getAButton(); + StageAngleSup = ()->driverControllerXbox.getYButton()||operatorControllerXbox.getYButton(); + FarStageAngleSup = ()->driverControllerXbox.getXButton()||operatorControllerXbox.getXButton(); + OppositeStageShotSup = ()->driverControllerXbox.getBButton()||operatorControllerXbox.getBButton(); + OverStagePassSup = ()-> operatorControllerXbox.getLeftBumper(); + CenterAmpPassSup =()-> operatorControllerXbox.getLeftTriggerAxis() >= 0.5; + AutoPickupSup = ()->driverControllerXbox.getLeftStickButton()||operatorControllerXbox.getLeftStickButton(); + zeroSup = ()->0; + falseSup = ()->false; + //discontinued buttons: + intakeReverse = ()->false; + ShooterUpManualSup = ()->false; + ForceVisionSup = ()->false; + ShootIfReadySup = ()->false; + } else{ + driverControllerPS4 = new PS4Controller(DRIVE_CONTROLLER_ID); + operatorControllerPS4 = new PS4Controller(OPERATOR_CONTROLLER_ID); + //operatorController = new PS4Controller(OPERATOs_CONTROLLER_ID); + PDP = new PowerDistribution(1, ModuleType.kRev); + + ZeroGyroSup = driverControllerPS4::getPSButton; + ForceVisionSup = driverControllerPS4::getOptionsButton; + + AimWhileMovingSup = driverControllerPS4::getL2Button; + HumanPlaySup = driverControllerPS4::getR1Button; + AmpAngleSup = ()->driverControllerPS4.getPOV() == 90||driverControllerPS4.getPOV() == 45||driverControllerPS4.getPOV() == 135;; + ManualShootSup = driverControllerPS4::getR2Button; + ClimberDownSup = operatorControllerPS4::getPSButton; + GroundIntakeSup = driverControllerPS4::getL1Button; + OperatorRevToZero = ()->operatorControllerPS4.getPOV() != -1; + SubwooferAngleSup =()-> driverControllerPS4.getCrossButton()||operatorControllerPS4.getCrossButton(); + StageAngleSup = ()->operatorControllerPS4.getTriangleButton()||driverControllerPS4.getTriangleButton();; + FarStageAngleSup = ()->operatorControllerPS4.getSquareButton()||driverControllerPS4.getSquareButton(); + OppositeStageShotSup = ()->operatorControllerPS4.getCircleButton()||driverControllerPS4.getCircleButton(); + OverStagePassSup = operatorControllerPS4::getL1Button; + CenterAmpPassSup = operatorControllerPS4::getL2Button; + AutoPickupSup = ()->operatorControllerPS4.getTouchpad()||driverControllerPS4.getTouchpad(); + zeroSup = ()->0; + falseSup = ()->false; + //discontinued buttons: + intakeReverse = ()->false; + ShooterUpManualSup = ()->false; + ForceVisionSup = ()->false; + ShootIfReadySup = ()->false; } // = new PathPlannerPath(null, DEFAUL_PATH_CONSTRAINTS, null, climberExists); @@ -283,7 +281,7 @@ private void climbSpotChooserInit() { } private void driveTrainInst() { driveTrain = new DrivetrainSubsystem(); - if(controllerType){ + if(useXboxController){ defaultDriveCommand = new Drive( driveTrain, () -> false, @@ -292,7 +290,7 @@ private void driveTrainInst() { () -> modifyAxis(-driverControllerXbox.getRawAxis(Z_AXIS), DEADBAND_NORMAL)); driveTrain.setDefaultCommand(defaultDriveCommand); } - else if(!controllerType){ + else{ defaultDriveCommand = new Drive( driveTrain, () -> false, @@ -315,14 +313,14 @@ private void intakeInst() { } private void climberInst() { climber = new Climber(); - if(controllerType){ + if(useXboxController){ climber.setDefaultCommand(new ClimberCommand( climber, ()-> modifyAxis(operatorControllerXbox.getLeftY(), DEADBAND_NORMAL), ()-> modifyAxis(operatorControllerXbox.getRightY(), DEADBAND_NORMAL), ClimberDownSup)); } - else if(!controllerType){ + else{ climber.setDefaultCommand(new ClimberCommand( climber, ()-> modifyAxis(operatorControllerPS4.getLeftY(), DEADBAND_NORMAL), @@ -373,7 +371,7 @@ public boolean runsWhenDisabled() { // new Trigger(driverController::getCrossButton).onTrue(new autoAimParallel(driveTrain/*, shooter*/)); new Trigger(ZeroGyroSup).onTrue(new InstantCommand(driveTrain::zeroGyroscope)); // new Trigger(driverController::getCircleButton).whileTrue(new GoToAmp(driveTrain)); unused becuase we dont pickup from amp with a path anymore - if(controllerType){ + if(useXboxController){ new Trigger(AimWhileMovingSup).whileTrue(new AimRobotMoving( driveTrain, () -> modifyAxis(-driverControllerXbox.getRawAxis(Z_AXIS), DEADBAND_NORMAL), @@ -388,7 +386,7 @@ public boolean runsWhenDisabled() { falseSup )); } - else if (!controllerType){ + else{ new Trigger(AimWhileMovingSup).whileTrue(new AimRobotMoving( driveTrain, () -> modifyAxis(-driverControllerPS4.getRawAxis(Z_AXIS), DEADBAND_NORMAL), @@ -452,10 +450,10 @@ else if (!controllerType){ SmartDashboard.putData("Manual Angle Shooter Up", new AngleShooter(angleShooterSubsystem, ()->ShooterConstants.PRAC_MAXIMUM_SHOOTER_ANGLE)); } if(indexerExists) { - if(controllerType){ + if(useXboxController){ new Trigger(ManualShootSup).whileTrue(new ManualShoot(indexer, driverControllerXbox::getPOV, intake)); } - else if(!controllerType){ + else{ new Trigger(ManualShootSup).whileTrue(new ManualShoot(indexer, driverControllerPS4::getPOV, intake)); } } diff --git a/src/main/java/frc/robot/settings/Constants.java b/src/main/java/frc/robot/settings/Constants.java index 7f9f5a8..a378e4e 100644 --- a/src/main/java/frc/robot/settings/Constants.java +++ b/src/main/java/frc/robot/settings/Constants.java @@ -452,10 +452,6 @@ public final class PS4Operator{ } - public final class Controllers{ - public static final boolean CONTROLLER_IS_XBOX = false; - } - public final class Field{ public static final double ROBOT_CENTER_TO_BUMBER = 0.419;