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 6, 2024
1 parent ab58227 commit 1b82b8a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,17 @@ private void configureBindings() {
// AlignCommand.getAmpAlignCommand(swerveSubsystem, fmsSubsystem.isRedAlliance()),
// new ConditionalWaitCommand(
// () -> !driveController.getAmpAlign().getAsBoolean()))
// ).andThen(new InstantCommand(() -> lightBarSubsystem.setLightBarStatus(LightBarStatus.DORMANT, 1)))
// ).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(
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 1b82b8a

Please sign in to comment.