|
11 | 11 |
|
12 | 12 | import org.littletonrobotics.junction.AutoLogOutput;
|
13 | 13 | import org.littletonrobotics.junction.Logger;
|
| 14 | +import org.littletonrobotics.junction.networktables.LoggedDashboardBoolean; |
14 | 15 |
|
15 | 16 | import static frc.robot.subsystems.shooter.ShooterConstants.*;
|
16 | 17 |
|
@@ -60,13 +61,17 @@ public Shooter(ShooterIO io) {
|
60 | 61 | shooterIO.setRightPID(rightkP.get(), rightkI.get(), rightkD.get());
|
61 | 62 | }
|
62 | 63 |
|
63 |
| - //Check if the actual voltage is close to the desired voltage |
64 |
| - public boolean isVoltageClose(double setVoltage, double tolerance) { |
65 |
| - // Calculate the absolute difference between the desired and applied voltages |
66 |
| - double voltageDifference = Math.abs(setVoltage - inputs.appliedVoltage); |
67 |
| - |
68 |
| - // Check if the absolute difference is within the tolerance |
69 |
| - return voltageDifference <= tolerance; |
| 64 | + @AutoLogOutput(key = "Shooter/CloseRight") |
| 65 | + public boolean isVoltageRightClose(double setVoltage) { |
| 66 | + double voltageDifference = Math.abs(setVoltage - shooterInputs.rightFlywheelAppliedVolts); |
| 67 | + return voltageDifference <= SHOOTER_TOLERANCE; |
| 68 | + } |
| 69 | + |
| 70 | + @AutoLogOutput(key = "Shooter/CloseLeft") |
| 71 | + public boolean isVoltageLeftClose(double setVoltage) { |
| 72 | + double voltageDifference = Math.abs(setVoltage - shooterInputs.leftFlywheelAppliedVolts); |
| 73 | + return voltageDifference <= SHOOTER_TOLERANCE; |
| 74 | + } |
70 | 75 |
|
71 | 76 |
|
72 | 77 | @Override
|
@@ -183,8 +188,8 @@ public void setVoltage(DoubleSupplier leftVoltage, DoubleSupplier rightVoltage){
|
183 | 188 | } else {
|
184 | 189 | shooterIO.setVoltage(leftMotorVoltage, rightMotorVoltage);
|
185 | 190 | }
|
186 |
| - } |
187 |
| - Logger.recordOutput('Shooter/Close', isVoltageClose(voltage, 1)); |
| 191 | + isVoltageLeftClose(leftVoltage.getAsDouble()); |
| 192 | + isVoltageRightClose(rightVoltage.getAsDouble()); |
188 | 193 | }
|
189 | 194 |
|
190 | 195 | public void setVoltage(double volts){
|
|
0 commit comments