diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index ad99770..855be49 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -182,6 +182,8 @@ private void configureBindings() { ) ); + _operatorController.povDown().whileTrue(new SetShooter(_shooterSubsystem, _shooterSubsystem::adjustedAngle)); + // driver bindings _driveController.L1().onTrue(Commands.runOnce(_swerveSubsystem::toggleSpeed, _swerveSubsystem)); _driveController.R1().onTrue(Commands.runOnce(() -> _swerveSubsystem.fieldOriented = !_swerveSubsystem.fieldOriented, _swerveSubsystem)); diff --git a/src/main/java/frc/robot/subsystems/ShooterSubsystem.java b/src/main/java/frc/robot/subsystems/ShooterSubsystem.java index cc93b4f..340838e 100644 --- a/src/main/java/frc/robot/subsystems/ShooterSubsystem.java +++ b/src/main/java/frc/robot/subsystems/ShooterSubsystem.java @@ -55,6 +55,7 @@ public class ShooterSubsystem extends SubsystemBase { private final Timer _revTimer = new Timer(); private double _shooterTrim = 0; + private double _shooterAdjust = 0; private boolean _holdNote = false; @@ -94,6 +95,7 @@ public ShooterSubsystem() { _angleController.setTolerance(2.5); SmartDashboard.putNumber("SHOOTER TRIM", _shooterTrim); + SmartDashboard.putNumber("SHOOTER ADJUST", _shooterAdjust); } @Override @@ -110,6 +112,14 @@ public void periodic() { SmartDashboard.putBoolean("SHOOTER REVVED", isRevved()); _shooterTrim = SmartDashboard.getNumber("SHOOTER TRIM", _shooterTrim); + _shooterAdjust = SmartDashboard.getNumber("SHOOTER ADJUST", _shooterAdjust); + } + + /** + * Returns the adjusted shooter angle. + */ + public double adjustedAngle() { + return getAngle() + _shooterAdjust; } // for resetting the shooter's angle