Skip to content

Commit

Permalink
added stage-align binding
Browse files Browse the repository at this point in the history
  • Loading branch information
MysticalApple committed Apr 3, 2024
1 parent 5e01a3d commit 7dda772
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ private void configureBindings() {
/* Shooter Aim -- Holding down the button will change the shooter's pitch to aim it at the speaker. */
// drive

/* Amp Align -- Pressing and holding the button will cause the robot to automatically path find to the amp.
/* Amp Align -- Pressing and holding the button will cause the robot to automatically pathfind to the amp.
* Releasing the button will stop the robot (and the path finding). */
driveController.getAmpAlign().onTrue(new InstantCommand(
() -> lightBarSubsystem.setLightBarStatus(LightBarStatus.AUTO_ALIGN, 1)
Expand All @@ -279,6 +279,13 @@ private void configureBindings() {
).andThen(new InstantCommand(() -> lightBarSubsystem.setLightBarStatus(LightBarStatus.DORMANT, 1)))
);

/* Stage Align -- Pressing and holding the button will cause the robot to automatically pathfind such that its
* climb hooks will end up directly above the center of the nearest chain. */
driveController.getStageAlignButton().onTrue(
AlignCommand.getAmpAlignCommand(swerveSubsystem, fmsSubsystem.isRedAlliance())
.onlyWhile(driveController.getStageAlignButton())
);

/* Note align -- deprecated, new version in the works*/
driveController.getNoteAlign().onTrue(
new NoteAlignCommand(swerveSubsystem, noteDetector, driveController)
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/frc/robot/controllers/BaseDriveController.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,7 @@ public abstract class BaseDriveController {
* Gets the button to aim the shooter at the speaker.
*/
public abstract JoystickButton getShooterAimButton();

/** Returns the button to auto-align to the nearest stage face. */
public abstract JoystickButton getStageAlignButton();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class DualJoystickDriveController extends BaseDriveController {
private final JoystickButton leftMiddleButton = new JoystickButton(leftJoystick, 2);
private final JoystickButton leftTopLeftButton = new JoystickButton(leftJoystick, 3);
private final JoystickButton leftTopRightButton = new JoystickButton(leftJoystick, 4);
private final JoystickButton leftBottomLeftButton = new JoystickButton(leftJoystick, 5);

private final Joystick rightJoystick = new Joystick(1);
private final JoystickButton rightTrigger = new JoystickButton(rightJoystick, 1);
Expand Down Expand Up @@ -100,5 +101,10 @@ public Boolean getSwerveAimMode() {
@Override
public JoystickButton getShooterAimButton() {
return leftTopRightButton;
}
}

@Override
public JoystickButton getStageAlignButton() {
return leftBottomLeftButton;
}
}
11 changes: 10 additions & 1 deletion src/main/java/frc/robot/controllers/XboxDriveController.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class XboxDriveController extends BaseDriveController {
private final JoystickButton driveLStickButton = new JoystickButton(
driveController, XboxController.Button.kLeftStick.value
);
private final JoystickButton driveRStickButton = new JoystickButton(
driveController, XboxController.Button.kRightStick.value
);

@Override
public double getForwardPower() {
Expand Down Expand Up @@ -77,7 +80,13 @@ public Boolean getSwerveAimMode() {
return driveLStickButton.getAsBoolean();
}

public JoystickButton getShooterAimButton(){
@Override
public JoystickButton getShooterAimButton() {
return driveLStickButton;
}

@Override
public JoystickButton getStageAlignButton() {
return driveRStickButton;
}
}

0 comments on commit 7dda772

Please sign in to comment.