Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make controllers modular in robotContainer-- testing has never been easier!1! #113 #114

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,44 +117,44 @@ public RobotContainer() {
}

private void configureButtonBindings() {
configureDriverBindings();
configureOperatorBindings();
configureDriverBindings(driver);
configureOperatorBindings(operator);
}

private void configureOperatorBindings() {
private void configureOperatorBindings(PatriBoxController controller) {

operator.povUp().toggleOnTrue(climb.povUpCommand(swerve::getPose));
controller.povUp().toggleOnTrue(climb.povUpCommand(swerve::getPose));

operator.povDown().onTrue(climb.toBottomCommand());
controller.povDown().onTrue(climb.toBottomCommand());

operator.povLeft().onTrue(elevator.toBottomCommand());
controller.povLeft().onTrue(elevator.toBottomCommand());

operator.povRight().onTrue(pieceControl.placeTrapCommand());
controller.povRight().onTrue(pieceControl.placeTrapCommand());

operator.leftBumper()
.and(operator.rightBumper())
controller.leftBumper()
.and(controller.rightBumper())
.onTrue(pieceControl.noteToShoot());

operator.rightBumper()
.and(operator.leftBumper().negate())
controller.rightBumper()
.and(controller.leftBumper().negate())
.onTrue(pieceControl.noteToTarget(() -> true));

operator.leftTrigger(OIConstants.OPERATOR_DEADBAND)
controller.leftTrigger(OIConstants.OPERATOR_DEADBAND)
.and(intake.hasGamePieceTrigger().negate())
.onTrue(intake.inCommand());

operator.rightTrigger(OIConstants.OPERATOR_DEADBAND)
controller.rightTrigger(OIConstants.OPERATOR_DEADBAND)
.onTrue(intake.outCommand());

operator.x().onTrue(intake.stop());
controller.x().onTrue(intake.stop());
}

private void configureDriverBindings() {
private void configureDriverBindings(PatriBoxController controller) {

// Upon hitting start or back,
// reset the orientation of the robot
// to be facing away from the driver station
driver.start().or(driver.back()).onTrue(
controller.start().or(driver.back()).onTrue(
Commands.runOnce(() -> swerve.resetOdometry(
new Pose2d(
swerve.getPose().getTranslation(),
Expand All @@ -164,37 +164,37 @@ private void configureDriverBindings() {
: 180))),
swerve));

driver.b()
controller.b()
.whileTrue(Commands.runOnce(swerve::getSetWheelsX));

driver.leftStick()
controller.leftStick()
.toggleOnTrue(swerve.toggleSpeed());

driver.a()
controller.a()
.and(intake.hasGamePieceTrigger().negate())
.onTrue(intake.inCommand());

driver.y()
controller.y()
.onTrue(intake.outCommand());

driver.leftBumper()
controller.leftBumper()
.toggleOnTrue(shooterCalc.prepareFireMovingCommand(() -> true, swerve::getPose));

driver.leftTrigger()
controller.leftTrigger()
.onTrue(shooterCalc.resetShooter());

driver.x()
controller.x()
.onTrue(intake.stop());

driver.rightStick()
controller.rightStick()
.whileTrue(
Commands.sequence(
swerve.resetHDC(),
swerve.getDriveCommand(
() -> {
return new ChassisSpeeds(
driver.getLeftY(),
driver.getLeftX(),
controller.getLeftY(),
controller.getLeftX(),
swerve.getAlignmentSpeeds(Rotation2d.fromDegrees(270)));
},
() -> true)));
Expand Down
Loading