Skip to content

Commit

Permalink
replaced amp-align binding with auto-amp
Browse files Browse the repository at this point in the history
  • Loading branch information
MysticalApple committed Apr 3, 2024
1 parent 90b4d66 commit 0a863b0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
35 changes: 25 additions & 10 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
import edu.wpi.first.wpilibj2.command.button.POVButton;
import frc.robot.Constants.SwerveConstants;
import frc.robot.commands.auton.AutoAmpSequence;
import frc.robot.commands.auton.AutonBuilder;
import frc.robot.commands.climb.ClimbLowerCommand;
import frc.robot.commands.elevator.ElevatorToAmpCommand;
Expand Down Expand Up @@ -269,17 +270,31 @@ 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.
* Releasing the button will stop the robot (and the path finding). */
driveController.getAmpAlign().onTrue(new InstantCommand(
() -> lightBarSubsystem.setLightBarStatus(LightBarStatus.AUTO_ALIGN, 1)
).andThen(new ParallelRaceGroup(
AlignCommand.getAmpAlignCommand(swerveSubsystem, fmsSubsystem.isRedAlliance()),
new ConditionalWaitCommand(
() -> !driveController.getAmpAlign().getAsBoolean()))
).andThen(new InstantCommand(() -> lightBarSubsystem.setLightBarStatus(LightBarStatus.DORMANT, 1)))
/* Automatic Amping -- Pressing and holding the button will cause the robot to automatically path find to the
* amp and deposit its note. Releasing the button will stop the robot (and the path finding). */
// TODO: Bring back LED integration.
driveController.getAutoAmp().onTrue(
new AutoAmpSequence(fmsSubsystem,
swerveSubsystem,
elevatorSubsystem,
intakePivotSubsystem,
intakeRollerSubsystem)

.onlyWhile(driveController.getAutoAmp())
);

// DEPRECATED AMP ALIGN
// driveController.getAmpAlign().onTrue(new InstantCommand(
// () -> lightBarSubsystem.setLightBarStatus(LightBarStatus.AUTO_ALIGN, 1)
// ).andThen(new ParallelRaceGroup(
// AlignCommand.getAmpAlignCommand(swerveSubsystem, fmsSubsystem.isRedAlliance()),
// new ConditionalWaitCommand(
// () -> !driveController.getAmpAlign().getAsBoolean()))
// ).andThen(new InstantCommand(() -> lightBarSubsystem.setLightBarStatus(LightBarStatus.DORMANT, 1)))
// );



/* Note align -- deprecated, new version in the works*/
driveController.getNoteAlign().onTrue(
new NoteAlignCommand(swerveSubsystem, noteDetector, driveController)
Expand Down Expand Up @@ -419,7 +434,7 @@ private void configureBindings() {
// if elevator is up
new ElevatorToZeroCommand(elevatorSubsystem).alongWith(new InstantCommand(// lower the elevator
() -> intakePivotSubsystem.setPosition(0), intakePivotSubsystem)), // stow the pivot

// if elevator is down
new PrepareAmpSequence(elevatorSubsystem, intakePivotSubsystem, intakeRollerSubsystem)
.until(() -> mechController.getLeftTriggerAxis() > .05
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/controllers/BaseDriveController.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ public abstract class BaseDriveController {
public abstract Boolean getRelativeMode();

/**
* Gets the button bound to auto-aligning to the amp.
* Gets the button bound to auto-align and -deposit into the amp.
*
* @return The JoystickButton to ampAlign.
*/
public abstract JoystickButton getAmpAlign();
public abstract JoystickButton getAutoAmp();

/**
* Gets the button bound to run the noteAlign sequence.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Boolean getRelativeMode() {
}

@Override
public JoystickButton getAmpAlign() {
public JoystickButton getAutoAmp() {
return leftTopLeftButton;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Boolean getRelativeMode() {
}

@Override
public JoystickButton getAmpAlign() {
public JoystickButton getAutoAmp() {
return xButton;
}

Expand Down

0 comments on commit 0a863b0

Please sign in to comment.