mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[build] Bring naming checkstyle rules up to date with Google Style guide (#1781)
Also update Checkstyle to 8.38. Google changed their style guide from the last time we imported it. This PR brings in those naming changes. The change they made is allowing single letter member, parameter, and local variable names. They also added a lambda naming scheme and I thought it would be good to bring that in too.
This commit is contained in:
@@ -26,7 +26,6 @@ public final class AngleStatistics {
|
||||
* @param b A vector to subtract with.
|
||||
* @param angleStateIdx The row containing angles to be normalized.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ParameterName")
|
||||
public static <S extends Num> Matrix<S, N1> angleResidual(Matrix<S, N1> a, Matrix<S, N1> b,
|
||||
int angleStateIdx) {
|
||||
Matrix<S, N1> ret = a.minus(b);
|
||||
@@ -41,7 +40,6 @@ public final class AngleStatistics {
|
||||
*
|
||||
* @param angleStateIdx The row containing angles to be normalized.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ParameterName")
|
||||
public static <S extends Num> BiFunction<Matrix<S, N1>, Matrix<S, N1>, Matrix<S, N1>>
|
||||
angleResidual(int angleStateIdx) {
|
||||
return (a, b) -> angleResidual(a, b, angleStateIdx);
|
||||
@@ -54,7 +52,6 @@ public final class AngleStatistics {
|
||||
* @param b A vector to add with.
|
||||
* @param angleStateIdx The row containing angles to be normalized.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ParameterName")
|
||||
public static <S extends Num> Matrix<S, N1> angleAdd(Matrix<S, N1> a, Matrix<S, N1> b,
|
||||
int angleStateIdx) {
|
||||
Matrix<S, N1> ret = a.plus(b);
|
||||
@@ -69,7 +66,6 @@ public final class AngleStatistics {
|
||||
*
|
||||
* @param angleStateIdx The row containing angles to be normalized.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ParameterName")
|
||||
public static <S extends Num> BiFunction<Matrix<S, N1>, Matrix<S, N1>, Matrix<S, N1>>
|
||||
angleAdd(int angleStateIdx) {
|
||||
return (a, b) -> angleAdd(a, b, angleStateIdx);
|
||||
@@ -119,7 +115,7 @@ public final class AngleStatistics {
|
||||
*
|
||||
* @param angleStateIdx The row containing the angles.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ParameterName")
|
||||
@SuppressWarnings("LambdaParameterName")
|
||||
public static <S extends Num> BiFunction<Matrix<S, ?>, Matrix<?, N1>, Matrix<S, N1>>
|
||||
angleMean(int angleStateIdx) {
|
||||
return (sigmas, Wm) -> angleMean(sigmas, Wm, angleStateIdx);
|
||||
|
||||
@@ -141,7 +141,7 @@ public class DifferentialDrivePoseEstimator {
|
||||
|
||||
m_visionCorrect = (u, y) -> m_observer.correct(
|
||||
Nat.N3(), u, y,
|
||||
(x, u_) -> new Matrix<>(x.getStorage().extractMatrix(0, 3, 0, 1)),
|
||||
(x, u1) -> new Matrix<>(x.getStorage().extractMatrix(0, 3, 0, 1)),
|
||||
m_visionDiscreteR,
|
||||
AngleStatistics.angleMean(2),
|
||||
AngleStatistics.angleResidual(2),
|
||||
|
||||
@@ -117,8 +117,8 @@ public class MecanumDrivePoseEstimator {
|
||||
|
||||
m_observer = new UnscentedKalmanFilter<>(
|
||||
Nat.N3(), Nat.N1(),
|
||||
(x_, u) -> u,
|
||||
(x, u_) -> x.extractRowVector(2),
|
||||
(x, u) -> u,
|
||||
(x, u) -> x.extractRowVector(2),
|
||||
stateStdDevs,
|
||||
localMeasurementStdDevs,
|
||||
AngleStatistics.angleMean(2),
|
||||
@@ -136,7 +136,7 @@ public class MecanumDrivePoseEstimator {
|
||||
|
||||
m_visionCorrect = (u, y) -> m_observer.correct(
|
||||
Nat.N3(), u, y,
|
||||
(x, u_) -> x,
|
||||
(x, u1) -> x,
|
||||
m_visionDiscreteR,
|
||||
AngleStatistics.angleMean(2),
|
||||
AngleStatistics.angleResidual(2),
|
||||
|
||||
@@ -117,8 +117,8 @@ public class SwerveDrivePoseEstimator {
|
||||
|
||||
m_observer = new UnscentedKalmanFilter<>(
|
||||
Nat.N3(), Nat.N1(),
|
||||
(x_, u) -> u,
|
||||
(x, u_) -> x.extractRowVector(2),
|
||||
(x, u) -> u,
|
||||
(x, u) -> x.extractRowVector(2),
|
||||
stateStdDevs,
|
||||
localMeasurementStdDevs,
|
||||
AngleStatistics.angleMean(2),
|
||||
@@ -136,7 +136,7 @@ public class SwerveDrivePoseEstimator {
|
||||
|
||||
m_visionCorrect = (u, y) -> m_observer.correct(
|
||||
Nat.N3(), u, y,
|
||||
(x, u_) -> x,
|
||||
(x, u1) -> x,
|
||||
m_visionDiscreteR,
|
||||
AngleStatistics.angleMean(2),
|
||||
AngleStatistics.angleResidual(2),
|
||||
|
||||
@@ -66,7 +66,7 @@ public class UnscentedKalmanFilter<States extends Num, Inputs extends Num,
|
||||
* @param measurementStdDevs Standard deviations of measurements.
|
||||
* @param nominalDtSeconds Nominal discretization timestep.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
@SuppressWarnings("LambdaParameterName")
|
||||
public UnscentedKalmanFilter(Nat<States> states, Nat<Outputs> outputs,
|
||||
BiFunction<Matrix<States, N1>, Matrix<Inputs, N1>,
|
||||
Matrix<States, N1>> f,
|
||||
@@ -329,7 +329,7 @@ public class UnscentedKalmanFilter<States extends Num, Inputs extends Num,
|
||||
* @param h A vector-valued function of x and u that returns the measurement vector.
|
||||
* @param R Measurement noise covariance matrix.
|
||||
*/
|
||||
@SuppressWarnings({"ParameterName", "LocalVariableName"})
|
||||
@SuppressWarnings({"ParameterName", "LambdaParameterName", "LocalVariableName"})
|
||||
public <R extends Num> void correct(
|
||||
Nat<R> rows, Matrix<Inputs, N1> u,
|
||||
Matrix<R, N1> y,
|
||||
|
||||
@@ -50,7 +50,6 @@ public class Pose2d {
|
||||
* @param y The y component of the translational component of the pose.
|
||||
* @param rotation The rotational component of the pose.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public Pose2d(double x, double y, Rotation2d rotation) {
|
||||
m_translation = new Translation2d(x, y);
|
||||
m_rotation = rotation;
|
||||
@@ -170,7 +169,6 @@ public class Pose2d {
|
||||
* the twist would be Twist2d{0.01, 0.0, toRadians(0.5)}
|
||||
* @return The new pose of the robot.
|
||||
*/
|
||||
@SuppressWarnings("LocalVariableName")
|
||||
public Pose2d exp(Twist2d twist) {
|
||||
double dx = twist.dx;
|
||||
double dy = twist.dy;
|
||||
|
||||
@@ -51,7 +51,6 @@ public class Rotation2d {
|
||||
* @param x The x component or cosine of the rotation.
|
||||
* @param y The y component or sine of the rotation.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public Rotation2d(double x, double y) {
|
||||
double magnitude = Math.hypot(x, y);
|
||||
if (magnitude > 1e-6) {
|
||||
|
||||
@@ -88,7 +88,7 @@ public class CubicHermiteSpline extends Spline {
|
||||
-3.0, -2.0, +3.0, -1.0,
|
||||
+0.0, +1.0, +0.0, +0.0,
|
||||
+1.0, +0.0, +0.0, +0.0
|
||||
});
|
||||
});
|
||||
}
|
||||
return hermiteBasis;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class QuinticHermiteSpline extends Spline {
|
||||
+00.0, +00.0, +00.5, +00.0, +00.0, +00.0,
|
||||
+00.0, +01.0, +00.0, +00.0, +00.0, +00.0,
|
||||
+01.0, +00.0, +00.0, +00.0, +00.0, +00.0
|
||||
});
|
||||
});
|
||||
}
|
||||
return hermiteBasis;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public final class NumericalJacobian {
|
||||
* @param u Input vector.
|
||||
* @return The numerical Jacobian with respect to x for f(x, u, ...).
|
||||
*/
|
||||
@SuppressWarnings({"ParameterName", "MethodTypeParameterName"})
|
||||
@SuppressWarnings({"LambdaParameterName", "MethodTypeParameterName"})
|
||||
public static <Rows extends Num, States extends Num, Inputs extends Num, Outputs extends Num>
|
||||
Matrix<Rows, States> numericalJacobianX(
|
||||
Nat<Rows> rows,
|
||||
@@ -94,7 +94,7 @@ public final class NumericalJacobian {
|
||||
* @param u Input vector.
|
||||
* @return the numerical Jacobian with respect to u for f(x, u).
|
||||
*/
|
||||
@SuppressWarnings({"ParameterName", "MethodTypeParameterName"})
|
||||
@SuppressWarnings({"LambdaParameterName", "MethodTypeParameterName"})
|
||||
public static <Rows extends Num, States extends Num, Inputs extends Num> Matrix<Rows, Inputs>
|
||||
numericalJacobianU(
|
||||
Nat<Rows> rows,
|
||||
|
||||
@@ -168,7 +168,6 @@ public class TrapezoidProfile {
|
||||
*
|
||||
* @param t The time since the beginning of the profile.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public State calculate(double t) {
|
||||
State result = new State(m_initial.position, m_initial.velocity);
|
||||
|
||||
@@ -274,7 +273,6 @@ public class TrapezoidProfile {
|
||||
*
|
||||
* @param t The time since the beginning of the profile.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public boolean isFinished(double t) {
|
||||
return t >= totalTime();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user