Skip to content

Commit

Permalink
Lob shot align working
Browse files Browse the repository at this point in the history
  • Loading branch information
RHR2713 committed Apr 3, 2024
1 parent f2d8827 commit df47a1d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,13 @@ public void createOperatorBindings() {
.b()
.whileTrue(
Commands.sequence(
Cmds.setState(MotionMode.LOB_SHOT_ALIGN),
new WaitUntilCommand(() -> intake.state == Intake.State.OFF),
Cmds.setState(ShooterState.LOB_SHOT),
Cmds.setState(ShooterPivot.State.LOB_SHOT)))
.whileFalse(
Commands.sequence(
Cmds.setState(MotionMode.FULL_DRIVE),
Cmds.setState(FeederState.FEED_SHOT),
new WaitUntilCommand(() -> !Robot.shooter.hasGamePiece()),
new WaitCommand(0.1),
Expand Down Expand Up @@ -728,7 +730,8 @@ public void robotPeriodic() {
updatePreMatchDashboardValues();

if (Math.abs(driver.getRightX()) > 0.25
&& swerveDrive.getMotionMode() != MotionMode.DRIVE_TOWARDS_GP) {
&& swerveDrive.getMotionMode() != MotionMode.DRIVE_TOWARDS_GP
&& swerveDrive.getMotionMode() != MotionMode.LOB_SHOT_ALIGN) {
swerveDrive.setMotionMode(MotionMode.FULL_DRIVE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public enum MotionMode {
TRAJECTORY,
LOCKDOWN,
ALIGN_TO_TAG,
DRIVE_TOWARDS_GP
DRIVE_TOWARDS_GP,
LOB_SHOT_ALIGN
}

SwerveIO io;
Expand Down Expand Up @@ -495,6 +496,9 @@ public void periodic() {
case ALIGN_TO_TAG:
setDesiredChassisSpeeds(MotionHandler.driveAlignToTag());
break;
case LOB_SHOT_ALIGN:
setDesiredChassisSpeeds(MotionHandler.driveLobShotAlign());
break;
case DRIVE_TOWARDS_GP:
setDesiredChassisSpeeds(MotionHandler.driveTowardsGP());
break;
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/frc/robot/util/MotionHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ public static ChassisSpeeds driveAlignToTag() {
return driveHeadingController();
}

public static ChassisSpeeds driveLobShotAlign() {
SwerveHeadingController.getInstance()
.setSetpoint(RotateScore.getOptimalAmpAngle(Robot.swerveDrive.getEstimatedPose()));

return driveHeadingController();
}

public static ChassisSpeeds driveTowardsGP() {
Logger.recordOutput("OTF/DrivingToGP/HasGPLock", VehicleState.getInstance().hasGPLock);

Expand Down

0 comments on commit df47a1d

Please sign in to comment.