mirror of
https://github.com/Team4388/2024AcrossTheRidgebotiverse.git
synced 2026-06-09 00:38:02 -06:00
PID no work
This commit is contained in:
@@ -68,18 +68,12 @@ public class RobotContainer {
|
||||
|
||||
// private final Intake m_robotIntake = new Intake(m_robotMap.intakeMotor, m_robotMap.pivotMotor);
|
||||
|
||||
// public final SwerveDrive m_robotSwerveDrive = new SwerveDrive(m_robotMap.leftFront,
|
||||
// m_robotMap.rightFront,
|
||||
// m_robotMap.leftBack,
|
||||
// m_robotMap.rightBack,
|
||||
public final SwerveDrive m_robotSwerveDrive = new SwerveDrive(m_robotMap.leftFront,
|
||||
m_robotMap.rightFront,
|
||||
m_robotMap.leftBack,
|
||||
m_robotMap.rightBack,
|
||||
|
||||
// m_robotMap.gyro);
|
||||
/* Limelight */
|
||||
// private final Limelight limelight = new Limelight();
|
||||
|
||||
// private final Shooter m_robotShooter = new Shooter(m_robotMap.leftShooter, m_robotMap.rightShooter, limelight);
|
||||
|
||||
// private final Climber m_robotClimber = new Climber(m_robotMap.climbMotor);
|
||||
m_robotMap.gyro);
|
||||
|
||||
/* Controllers */
|
||||
private final DeadbandedXboxController m_driverXbox = new DeadbandedXboxController(OIConstants.XBOX_DRIVER_ID);
|
||||
@@ -119,53 +113,6 @@ public class RobotContainer {
|
||||
// );
|
||||
|
||||
|
||||
// private SequentialCommandGroup i = new SequentialCommandGroup(
|
||||
// intakeToShootStuff, intakeToShoot,
|
||||
// new InstantCommand(() -> m_robotShooter.idle())
|
||||
// );
|
||||
|
||||
// private SequentialCommandGroup ejectToShoot = new SequentialCommandGroup(
|
||||
// new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter),
|
||||
// new WaitCommand(0.75),
|
||||
// new InstantCommand(() -> m_robotIntake.handoff(), m_robotIntake)
|
||||
// );
|
||||
|
||||
// private SequentialCommandGroup turnOffShoot = new SequentialCommandGroup(
|
||||
// new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter)
|
||||
// // new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake)
|
||||
// );
|
||||
|
||||
// private SequentialCommandGroup emergencyRetract = new SequentialCommandGroup(
|
||||
// interrupt,
|
||||
// new InstantCommand(() -> m_robotIntake.PIDIn(), m_robotIntake),
|
||||
// new InstantCommand(() -> m_robotIntake.stopIntakeMotors(), m_robotIntake)
|
||||
// );
|
||||
|
||||
// private SequentialCommandGroup ampShoot = new SequentialCommandGroup(
|
||||
// new InstantCommand(() -> m_robotIntake.ampPosition()),
|
||||
// new InstantCommand(() -> m_robotIntake.ampOuttake(0.1)) //TODO: Find Actual Speed
|
||||
// );
|
||||
|
||||
// ! /* Autos */
|
||||
// private Command taxi = new JoystickPlayback(m_robotSwerveDrive, "Taxi.txt");
|
||||
// private String lastAutoName = "final_red_center_4note_taxi.auto";
|
||||
// private ConfigurableString autoplaybackName = new ConfigurableString("Auto Playback Name", lastAutoName);
|
||||
// private neoJoystickPlayback autoPlayback = new neoJoystickPlayback(m_robotSwerveDrive,
|
||||
// () -> autoplaybackName.get(), // lastAutoName
|
||||
// new VirtualController[]{getVirtualDriverController(), getVirtualOperatorController()},
|
||||
// true, false);
|
||||
|
||||
|
||||
// private PlaybackChooser playbackChooser = new PlaybackChooser(m_robotSwerveDrive)
|
||||
// .addOption("Taxi Auto", taxi.asProxy())
|
||||
// .addOption("One Note Auto Starting in Front of Speaker", oneNoteStartingSpeaker.asProxy())
|
||||
// .addOption("Stay One Note Auto Starting in Front of Speaker", oneNoteStartingSpeakerStationary.asProxy())
|
||||
// // .addOption("One Note Auto Starting from Left Position", oneNoteStartingFromLeft.asProxy())
|
||||
// // .addOption("One Note Auto Starting from Right Position", oneNoteStartingFromRight.asProxy())
|
||||
// .addOption("Two Note Starting in Front of Speaker", twoNoteStartingFromSpeaker.asProxy())
|
||||
// .addOption("Stay Two Note Starting in Front of Speaker", stayTwoNoteStartingFromSpeaker.asProxy())
|
||||
// .buildDisplay();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -173,7 +120,7 @@ public class RobotContainer {
|
||||
*/
|
||||
public RobotContainer() {
|
||||
configureButtonBindings();
|
||||
configureVirtualButtonBindings();
|
||||
// configureVirtualButtonBindings();
|
||||
// new Trigger(() -> autoplaybackName.get().equals(lastAutoName)).onTrue(new InstantCommand(() -> changeAuto()));
|
||||
// new DeferredBlock(() -> m_robotSwerveDrive.resetGyro());
|
||||
|
||||
@@ -202,7 +149,17 @@ public class RobotContainer {
|
||||
// getDeadbandedDriverController().getRightX(),
|
||||
// getDeadbandedDriverController().getRightY(),
|
||||
// true);
|
||||
// }, m_robotSwerveDrive)
|
||||
// }, m_robotSwerveDrive));
|
||||
|
||||
m_robotSwerveDrive.setDefaultCommand(new RunCommand(() -> {
|
||||
m_robotSwerveDrive.oneModuleTest(
|
||||
m_robotMap.rightFront,
|
||||
getDeadbandedDriverController().getLeft(),
|
||||
getDeadbandedDriverController().getRight());
|
||||
}, m_robotSwerveDrive));
|
||||
|
||||
|
||||
|
||||
// .withName("SwerveDrive OrientationCommand"));
|
||||
// continually sends updates to the Blinkin LED controller to keep the lights on
|
||||
// m_robotLED.setDefaultCommand(new RunCommand(() -> m_robotLED.updateLED(), m_robotLED));
|
||||
@@ -223,190 +180,6 @@ public class RobotContainer {
|
||||
*/
|
||||
private void configureButtonBindings() {
|
||||
|
||||
// ? /* Driver Buttons */
|
||||
|
||||
// DualJoystickButton(getDeadbandedDriverController(), getVirtualDriverController(), XboxController.A_BUTTON)
|
||||
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.resetGyroFlip(), m_robotSwerveDrive));
|
||||
|
||||
// DualJoystickButton(getDeadbandedDriverController(), getVirtualDriverController(), XboxController.BACK_BUTTON)
|
||||
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.resetGyroRightBlue()))
|
||||
// .onFalse(new InstantCommand(() -> m_robotSwerveDrive.add180()));
|
||||
|
||||
// DualJoystickButton(getDeadbandedDriverController(), getVirtualDriverController(), XboxController.START_BUTTON)
|
||||
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.resetGyroRightAmp()))
|
||||
// .onFalse(new InstantCommand(() -> m_robotSwerveDrive.add180()));
|
||||
|
||||
// * /* D-Pad Stuff */
|
||||
// new Trigger(() -> getDeadbandedDriverController().getRawAxis(XboxController.TOP_BOTTOM_DPAD_AXIS) > 0.9)
|
||||
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 1),
|
||||
// new Translation2d(0, 0),
|
||||
// true)))
|
||||
// .onFalse(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 0),
|
||||
// new Translation2d(0, 0),
|
||||
// true)));
|
||||
|
||||
// new Trigger(() -> getDeadbandedDriverController().getRawAxis(XboxController.TOP_BOTTOM_DPAD_AXIS) > -0.9)
|
||||
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, -1),
|
||||
// new Translation2d(0, 0),
|
||||
// true)))
|
||||
// .onFalse(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 0),
|
||||
// new Translation2d(0, 0),
|
||||
// true)));
|
||||
|
||||
// new Trigger(() -> getDeadbandedDriverController().getRawAxis(XboxController.LEFT_RIGHT_DPAD_AXIS) > 0.9)
|
||||
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(1, 0),
|
||||
// new Translation2d(0, 0),
|
||||
// true)))
|
||||
// .onFalse(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 0),
|
||||
// new Translation2d(0, 0),
|
||||
// true)));
|
||||
|
||||
// new Trigger(() -> getDeadbandedDriverController().getRawAxis(XboxController.LEFT_RIGHT_DPAD_AXIS) > -0.9)
|
||||
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(-1, 0),
|
||||
// new Translation2d(0, 0),
|
||||
// true)))
|
||||
// .onFalse(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 0),
|
||||
// new Translation2d(0, 0),
|
||||
// true)));
|
||||
|
||||
// ! /* Auto Recording */
|
||||
// new JoystickButton(m_autoRecorderXbox, XboxController.LEFT_BUMPER_BUTTON)
|
||||
// .whileTrue(new neoJoystickRecorder(m_robotSwerveDrive,
|
||||
// new DeadbandedXboxController[]{getDeadbandedDriverController(), getDeadbandedOperatorController()},
|
||||
// () -> autoplaybackName.get()))
|
||||
// .onFalse(new InstantCommand());
|
||||
|
||||
// new JoystickButton(m_autoRecorderXbox, XboxController.RIGHT_BUMPER_BUTTON)
|
||||
// .onTrue(new neoJoystickPlayback(m_robotSwerveDrive,
|
||||
// () -> autoplaybackName.get(),
|
||||
// new VirtualController[]{getVirtualDriverController(), getVirtualOperatorController()},
|
||||
// true, false))
|
||||
// .onFalse(new InstantCommand());
|
||||
|
||||
// new JoystickButton(getDeadbandedDriverController(), XboxController.RIGHT_BUMPER_BUTTON)
|
||||
// .whileTrue(new JoystickRecorder(m_robotSwerveDrive,
|
||||
// () -> getDeadbandedDriverController().getLeftX(),
|
||||
// () -> getDeadbandedDriverController().getLeftY(),
|
||||
// () -> getDeadbandedDriverController().getRightX(),
|
||||
// () -> getDeadbandedDriverController().getRightY(),
|
||||
// "Taxi.txt"))
|
||||
// .onFalse(new InstantCommand());
|
||||
|
||||
// new JoystickButton(getDeadbandedDriverController(), XboxController.LEFT_BUMPER_BUTTON)
|
||||
// .onTrue(new JoystickPlayback(m_robotSwerveDrive, "Taxi.txt"))
|
||||
// .onFalse(new InstantCommand());
|
||||
// ! /* Speed */
|
||||
// new JoystickButton(getDeadbandedDriverController(), XboxController.RIGHT_BUMPER_BUTTON) // final
|
||||
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftUp()));
|
||||
// // .onFalse(new InstantCommand(() -> m_robotSwerveDrive.setToFast()));
|
||||
|
||||
// new JoystickButton(getDeadbandedDriverController(), XboxController.LEFT_BUMPER_BUTTON) // final
|
||||
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftDown()));
|
||||
|
||||
// new Trigger(() -> getDeadbandedDriverController().getPOV() == 270)
|
||||
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftDownRot()));
|
||||
|
||||
// new Trigger(() -> getDeadbandedDriverController().getPOV() == 90)
|
||||
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftUpRot()));
|
||||
|
||||
// new JoystickButton(getDeadbandedDriverController(), XboxController.Y_BUTTON)
|
||||
// .whileTrue(new InstantCommand(() ->
|
||||
// m_robotSwerveDrive.driveWithInput(new Translation2d(0, 1),
|
||||
// new Translation2d(0, 0),
|
||||
// true), m_robotSwerveDrive));
|
||||
|
||||
|
||||
//? /* Operator Buttons */
|
||||
|
||||
// new Joystick(getDeadbandedOperatorController(), XboxController.Y_BUTTON)
|
||||
// .onTrue(new InstantCommand(() -> m_robotMap.rightFront.go(new Translation2d())));
|
||||
|
||||
// DualJoystickButton(getDeadbandedOperatorController(), getVirtualOperatorController(), XboxController.X_BUTTON)
|
||||
// .onTrue(new InstantCommand(() -> m_robotIntake.PIDOut()))
|
||||
// .onFalse(new InstantCommand(() -> m_robotIntake.stopArmMotor()));
|
||||
|
||||
// DualJoystickButton(getDeadbandedOperatorController(), getVirtualOperatorController(), XboxController.A_BUTTON)
|
||||
// .onTrue(new InstantCommand(() -> m_robotIntake.handoff()))
|
||||
// .onFalse(new InstantCommand(() -> m_robotIntake.stopIntakeMotors()));
|
||||
|
||||
// DualJoystickButton(getDeadbandedOperatorController(), getVirtualOperatorController(), XboxController.B_BUTTON)
|
||||
// .onTrue(emergencyRetract);
|
||||
|
||||
|
||||
// Override Intake Position encoder: out
|
||||
// new JoystickButton(getDeadbandedOperatorController(), XboxController.BACK_BUTTON)
|
||||
// .onTrue(new InstantCommand(() -> m_robotIntake.setPivotEncoderPosition(-55), m_robotIntake));
|
||||
|
||||
// // Override Intake Position encoder: in
|
||||
// new JoystickButton(getDeadbandedOperatorController(), XboxController.START_BUTTON)
|
||||
// .onTrue(new InstantCommand(() -> m_robotIntake.setPivotEncoderPosition(-6.2), m_robotIntake));
|
||||
|
||||
// DualJoystickButton(getDeadbandedOperatorController(), getVirtualOperatorController(), XboxController.LEFT_BUMPER_BUTTON)
|
||||
// .onTrue(new InstantCommand(() -> m_robotShooter.spin(0.5), m_robotShooter))
|
||||
// .onFalse(turnOffShoot);
|
||||
|
||||
|
||||
// DualJoystickButton(getDeadbandedOperatorController(), getVirtualOperatorController(), XboxController.RIGHT_BUMPER_BUTTON)
|
||||
// .onTrue(i)
|
||||
// .onFalse(new InstantCommand(() -> m_robotIntake.PIDIn()));
|
||||
|
||||
// //spins up shooter, no wind down
|
||||
// DualJoystickButton(getDeadbandedOperatorController(), getVirtualOperatorController(), XboxController.LEFT_JOYSTICK_BUTTON)
|
||||
// .onTrue(new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter));
|
||||
|
||||
// // DualJoystickButton(getDeadbandedOperatorController(), getVirtualOperatorController(), XboxController.RIGHT_JOYSTICK_BUTTON)
|
||||
// // .onTrue(new InstantCommand(() -> m_robotIntake.talonSpinIntakeMotor(), m_robotIntake))
|
||||
// // .onFalse(new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake));
|
||||
|
||||
// DualJoystickButton(getDeadbandedOperatorController(), getVirtualOperatorController(), XboxController.RIGHT_JOYSTICK_BUTTON)
|
||||
// .onTrue(emergencyRetract);
|
||||
|
||||
// new Trigger(() -> getDeadbandedOperatorController().getRawAxis(XboxController.RIGHT_TRIGGER_AXIS) > 0.5)
|
||||
// .onTrue(new InstantCommand(() -> m_robotClimber.climbOut()))
|
||||
// .onFalse(new InstantCommand(() -> m_robotClimber.stopClimb()));
|
||||
|
||||
// new Trigger(() -> getDeadbandedOperatorController().getRawAxis(XboxController.LEFT_TRIGGER_AXIS) > 0.5)
|
||||
// .onTrue(new InstantCommand(() -> m_robotClimber.climbIn()))
|
||||
// .onFalse(new InstantCommand(() -> m_robotClimber.stopClimb()));
|
||||
|
||||
// new Trigger(() -> getDeadbandedOperatorController().getPOV() == 0)
|
||||
// .onTrue(new InstantCommand(() -> m_robotIntake.ampOuttake(0.5)));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to replcate {@link Trigger Triggers} for {@link VirtualController Virtual Controllers}. <p/>
|
||||
* Please use {@link RobotContainer#DualJoystickButton} in {@link RobotContainer#configureButtonBindings} for standard buttons.
|
||||
*/
|
||||
private void configureVirtualButtonBindings() {
|
||||
|
||||
// ? /* Driver Buttons */
|
||||
|
||||
/* Notice: the following buttons have not been replicated
|
||||
* Swerve Drive Slow and Fast mode Gear Shifts : Fast mode is known to cause drift, so we disable that feature in Autoplayback
|
||||
* Swerve Drive Rotation Gear Shifts : Same reason as Slow and Fast mode.
|
||||
* Auto Recording controls : We don't want an Null Ouroboros for an auto.
|
||||
*/
|
||||
|
||||
// ? /* Operator Buttons */
|
||||
|
||||
/* Notice: the following buttons have not been replicated
|
||||
* Override Intake Position Encoder : It's an emergancy overide, for when the position of intake when the robot boots, the intake is not inside the robot.
|
||||
* We don't need it in an auto.
|
||||
* Climbing controls : We don't need to climb in auto.
|
||||
*/
|
||||
|
||||
// new Trigger(() -> getVirtualOperatorController().getRawAxis(XboxController.RIGHT_TRIGGER_AXIS) > 0.5)
|
||||
// .onTrue(new InstantCommand(() -> m_robotClimber.climbOut()))
|
||||
// .onFalse(new InstantCommand(() -> m_robotClimber.stopClimb()));
|
||||
|
||||
// new Trigger(() -> getVirtualOperatorController().getRawAxis(XboxController.LEFT_TRIGGER_AXIS) > 0.5)
|
||||
// .onTrue(new InstantCommand(() -> m_robotClimber.climbIn()))
|
||||
// .onFalse(new InstantCommand(() -> m_robotClimber.stopClimb()));
|
||||
|
||||
// new Trigger(() -> getVirtualOperatorController().getPOV() == 0)
|
||||
// .onTrue(new InstantCommand(() -> m_robotIntake.ampOuttake(0.5)));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user