Fix JDK 21 warnings (#6028)

This commit is contained in:
Tyler Veness
2023-12-09 21:45:02 -08:00
committed by GitHub
parent d40bdd70ba
commit 192a28af47
101 changed files with 164 additions and 57 deletions

View File

@@ -37,6 +37,7 @@ public class BangBangController implements Sendable {
*
* @param tolerance Tolerance for {@link #atSetpoint() atSetpoint}.
*/
@SuppressWarnings("this-escape")
public BangBangController(double tolerance) {
instances++;
@@ -89,7 +90,7 @@ public class BangBangController implements Sendable {
*
* @param tolerance Position error which is tolerable.
*/
public void setTolerance(double tolerance) {
public final void setTolerance(double tolerance) {
m_tolerance = tolerance;
}

View File

@@ -144,13 +144,13 @@ public class ControlAffinePlantInversionFeedforward<States extends Num, Inputs e
*
* @param initialState The initial state vector.
*/
public void reset(Matrix<States, N1> initialState) {
public final void reset(Matrix<States, N1> initialState) {
m_r = initialState;
m_uff.fill(0.0);
}
/** Resets the feedforward with a zero initial state vector. */
public void reset() {
public final void reset() {
m_r.fill(0.0);
m_uff.fill(0.0);
}

View File

@@ -99,7 +99,7 @@ public class ImplicitModelFollower<States extends Num, Inputs extends Num, Outpu
}
/** Resets the controller. */
public void reset() {
public final void reset() {
m_u.fill(0.0);
}

View File

@@ -105,13 +105,13 @@ public class LinearPlantInversionFeedforward<
*
* @param initialState The initial state vector.
*/
public void reset(Matrix<States, N1> initialState) {
public final void reset(Matrix<States, N1> initialState) {
m_r = initialState;
m_uff.fill(0.0);
}
/** Resets the feedforward with a zero initial state vector. */
public void reset() {
public final void reset() {
m_r.fill(0.0);
m_uff.fill(0.0);
}

View File

@@ -221,7 +221,7 @@ public class LinearQuadraticRegulator<States extends Num, Inputs extends Num, Ou
}
/** Resets the controller. */
public void reset() {
public final void reset() {
m_r.fill(0.0);
m_u.fill(0.0);
}

View File

@@ -81,6 +81,7 @@ public class PIDController implements Sendable, AutoCloseable {
* @param kd The derivative coefficient.
* @param period The period between controller updates in seconds. Must be non-zero and positive.
*/
@SuppressWarnings("this-escape")
public PIDController(double kp, double ki, double kd, double period) {
m_kp = kp;
m_ki = ki;

View File

@@ -50,6 +50,7 @@ public class ProfiledPIDController implements Sendable {
* @param constraints Velocity and acceleration constraints for goal.
* @param period The period between controller updates in seconds. The default is 0.02 seconds.
*/
@SuppressWarnings("this-escape")
public ProfiledPIDController(
double Kp, double Ki, double Kd, TrapezoidProfile.Constraints constraints, double period) {
m_controller = new PIDController(Kp, Ki, Kd, period);

View File

@@ -236,7 +236,7 @@ public class ExtendedKalmanFilter<States extends Num, Inputs extends Num, Output
}
@Override
public void reset() {
public final void reset() {
m_xHat = new Matrix<>(m_states, Nat.N1());
m_P = m_initP;
}

View File

@@ -172,7 +172,7 @@ public class KalmanFilter<States extends Num, Inputs extends Num, Outputs extend
}
@Override
public void reset() {
public final void reset() {
m_xHat = new Matrix<>(m_states, Nat.N1());
m_P = m_initP;
}

View File

@@ -80,7 +80,7 @@ public class PoseEstimator<T extends WheelPositions<T>> {
* numbers to trust global measurements from vision less. This matrix is in the form [x, y,
* theta]ᵀ, with units in meters and radians.
*/
public void setVisionMeasurementStdDevs(Matrix<N3, N1> visionMeasurementStdDevs) {
public final void setVisionMeasurementStdDevs(Matrix<N3, N1> visionMeasurementStdDevs) {
var r = new double[3];
for (int i = 0; i < 3; ++i) {
r[i] = visionMeasurementStdDevs.get(i, 0) * visionMeasurementStdDevs.get(i, 0);

View File

@@ -115,7 +115,7 @@ public class SteadyStateKalmanFilter<States extends Num, Inputs extends Num, Out
reset();
}
public void reset() {
public final void reset() {
m_xHat = new Matrix<>(m_states, Nat.N1());
}

View File

@@ -323,7 +323,7 @@ public class UnscentedKalmanFilter<States extends Num, Inputs extends Num, Outpu
/** Resets the observer. */
@Override
public void reset() {
public final void reset() {
m_xHat = new Matrix<>(m_states, Nat.N1());
m_S = new Matrix<>(m_states, m_states);
m_sigmasF = new Matrix<>(new SimpleMatrix(m_states.getNum(), 2 * m_states.getNum() + 1));

View File

@@ -265,7 +265,7 @@ public class LinearSystemLoop<States extends Num, Inputs extends Num, Outputs ex
*
* @param initialState The initial state.
*/
public void reset(Matrix<States, N1> initialState) {
public final void reset(Matrix<States, N1> initialState) {
m_nextR.fill(0.0);
m_controller.reset();
m_feedforward.reset(initialState);