diff --git a/wpimath/src/main/native/cpp/controller/BangBangController.cpp b/wpimath/src/main/native/cpp/controller/BangBangController.cpp index a4fda0a673..4a093d68c1 100644 --- a/wpimath/src/main/native/cpp/controller/BangBangController.cpp +++ b/wpimath/src/main/native/cpp/controller/BangBangController.cpp @@ -11,10 +11,7 @@ using namespace frc; BangBangController::BangBangController(double tolerance) - : m_tolerance(tolerance) { - static int instances = 0; - instances++; -} + : m_tolerance(tolerance) {} void BangBangController::SetSetpoint(double setpoint) { m_setpoint = setpoint; diff --git a/wpimath/src/main/native/cpp/trajectory/constraint/DifferentialDriveKinematicsConstraint.cpp b/wpimath/src/main/native/cpp/trajectory/constraint/DifferentialDriveKinematicsConstraint.cpp index 2a308dbc06..460ff8b5d7 100644 --- a/wpimath/src/main/native/cpp/trajectory/constraint/DifferentialDriveKinematicsConstraint.cpp +++ b/wpimath/src/main/native/cpp/trajectory/constraint/DifferentialDriveKinematicsConstraint.cpp @@ -7,9 +7,8 @@ using namespace frc; DifferentialDriveKinematicsConstraint::DifferentialDriveKinematicsConstraint( - const DifferentialDriveKinematics& kinematics, - units::meters_per_second_t maxSpeed) - : m_kinematics(kinematics), m_maxSpeed(maxSpeed) {} + DifferentialDriveKinematics kinematics, units::meters_per_second_t maxSpeed) + : m_kinematics(std::move(kinematics)), m_maxSpeed(maxSpeed) {} units::meters_per_second_t DifferentialDriveKinematicsConstraint::MaxVelocity( const Pose2d& pose, units::curvature_t curvature, diff --git a/wpimath/src/main/native/cpp/trajectory/constraint/DifferentialDriveVoltageConstraint.cpp b/wpimath/src/main/native/cpp/trajectory/constraint/DifferentialDriveVoltageConstraint.cpp index d60b4b68f2..46c306e09f 100644 --- a/wpimath/src/main/native/cpp/trajectory/constraint/DifferentialDriveVoltageConstraint.cpp +++ b/wpimath/src/main/native/cpp/trajectory/constraint/DifferentialDriveVoltageConstraint.cpp @@ -15,9 +15,9 @@ using namespace frc; DifferentialDriveVoltageConstraint::DifferentialDriveVoltageConstraint( const SimpleMotorFeedforward& feedforward, - const DifferentialDriveKinematics& kinematics, units::volt_t maxVoltage) + DifferentialDriveKinematics kinematics, units::volt_t maxVoltage) : m_feedforward(feedforward), - m_kinematics(kinematics), + m_kinematics(std::move(kinematics)), m_maxVoltage(maxVoltage) {} units::meters_per_second_t DifferentialDriveVoltageConstraint::MaxVelocity( diff --git a/wpimath/src/main/native/include/frc/filter/LinearFilter.h b/wpimath/src/main/native/include/frc/filter/LinearFilter.h index 0fb4f48bbc..858cef6f87 100644 --- a/wpimath/src/main/native/include/frc/filter/LinearFilter.h +++ b/wpimath/src/main/native/include/frc/filter/LinearFilter.h @@ -95,7 +95,7 @@ class LinearFilter { static int instances = 0; instances++; wpi::math::MathSharedStore::ReportUsage( - wpi::math::MathUsageId::kFilter_Linear, 1); + wpi::math::MathUsageId::kFilter_Linear, instances); } /** diff --git a/wpimath/src/main/native/include/frc/trajectory/constraint/DifferentialDriveKinematicsConstraint.h b/wpimath/src/main/native/include/frc/trajectory/constraint/DifferentialDriveKinematicsConstraint.h index 0edd8cc432..0d96893189 100644 --- a/wpimath/src/main/native/include/frc/trajectory/constraint/DifferentialDriveKinematicsConstraint.h +++ b/wpimath/src/main/native/include/frc/trajectory/constraint/DifferentialDriveKinematicsConstraint.h @@ -20,9 +20,8 @@ namespace frc { class WPILIB_DLLEXPORT DifferentialDriveKinematicsConstraint : public TrajectoryConstraint { public: - DifferentialDriveKinematicsConstraint( - const DifferentialDriveKinematics& kinematics, - units::meters_per_second_t maxSpeed); + DifferentialDriveKinematicsConstraint(DifferentialDriveKinematics kinematics, + units::meters_per_second_t maxSpeed); units::meters_per_second_t MaxVelocity( const Pose2d& pose, units::curvature_t curvature, diff --git a/wpimath/src/main/native/include/frc/trajectory/constraint/DifferentialDriveVoltageConstraint.h b/wpimath/src/main/native/include/frc/trajectory/constraint/DifferentialDriveVoltageConstraint.h index 40a0d8eff4..8f7ba2ce3f 100644 --- a/wpimath/src/main/native/include/frc/trajectory/constraint/DifferentialDriveVoltageConstraint.h +++ b/wpimath/src/main/native/include/frc/trajectory/constraint/DifferentialDriveVoltageConstraint.h @@ -34,7 +34,7 @@ class WPILIB_DLLEXPORT DifferentialDriveVoltageConstraint */ DifferentialDriveVoltageConstraint( const SimpleMotorFeedforward& feedforward, - const DifferentialDriveKinematics& kinematics, units::volt_t maxVoltage); + DifferentialDriveKinematics kinematics, units::volt_t maxVoltage); units::meters_per_second_t MaxVelocity( const Pose2d& pose, units::curvature_t curvature, diff --git a/wpimath/src/test/native/cpp/DARETest.cpp b/wpimath/src/test/native/cpp/DARETest.cpp index b8665fc36c..d57323354c 100644 --- a/wpimath/src/test/native/cpp/DARETest.cpp +++ b/wpimath/src/test/native/cpp/DARETest.cpp @@ -71,6 +71,7 @@ void ExpectDARESolution(const Eigen::Ref& A, ExpectMatrixEqual(Y, Eigen::MatrixXd::Zero(X.rows(), X.cols()), 1e-10); } +// NOLINTNEXTLINE (google-readability-avoid-underscore-in-googletest-name) TEST(DARETest, NonInvertibleA_ABQR) { // Example 2 of "On the Numerical Solution of the Discrete-Time Algebraic // Riccati Equation" @@ -90,6 +91,7 @@ TEST(DARETest, NonInvertibleA_ABQR) { ExpectDARESolution(A, B, Q, R, X); } +// NOLINTNEXTLINE (google-readability-avoid-underscore-in-googletest-name) TEST(DARETest, NonInvertibleA_ABQRN) { // Example 2 of "On the Numerical Solution of the Discrete-Time Algebraic // Riccati Equation" @@ -115,6 +117,7 @@ TEST(DARETest, NonInvertibleA_ABQRN) { ExpectDARESolution(A, B, Q, R, N, X); } +// NOLINTNEXTLINE (google-readability-avoid-underscore-in-googletest-name) TEST(DARETest, InvertibleA_ABQR) { Eigen::MatrixXd A{2, 2}; A << 1, 1, 0, 1; @@ -131,6 +134,7 @@ TEST(DARETest, InvertibleA_ABQR) { ExpectDARESolution(A, B, Q, R, X); } +// NOLINTNEXTLINE (google-readability-avoid-underscore-in-googletest-name) TEST(DARETest, InvertibleA_ABQRN) { Eigen::MatrixXd A{2, 2}; A << 1, 1, 0, 1; @@ -153,6 +157,7 @@ TEST(DARETest, InvertibleA_ABQRN) { ExpectDARESolution(A, B, Q, R, N, X); } +// NOLINTNEXTLINE (google-readability-avoid-underscore-in-googletest-name) TEST(DARETest, FirstGeneralizedEigenvalueOfSTIsStable_ABQR) { // The first generalized eigenvalue of (S, T) is stable @@ -171,6 +176,7 @@ TEST(DARETest, FirstGeneralizedEigenvalueOfSTIsStable_ABQR) { ExpectDARESolution(A, B, Q, R, X); } +// NOLINTNEXTLINE (google-readability-avoid-underscore-in-googletest-name) TEST(DARETest, FirstGeneralizedEigenvalueOfSTIsStable_ABQRN) { // The first generalized eigenvalue of (S, T) is stable @@ -195,6 +201,7 @@ TEST(DARETest, FirstGeneralizedEigenvalueOfSTIsStable_ABQRN) { ExpectDARESolution(A, B, Q, R, N, X); } +// NOLINTNEXTLINE (google-readability-avoid-underscore-in-googletest-name) TEST(DARETest, IdentitySystem_ABQR) { const Eigen::MatrixXd A{Eigen::Matrix2d::Identity()}; const Eigen::MatrixXd B{Eigen::Matrix2d::Identity()}; @@ -207,6 +214,7 @@ TEST(DARETest, IdentitySystem_ABQR) { ExpectDARESolution(A, B, Q, R, X); } +// NOLINTNEXTLINE (google-readability-avoid-underscore-in-googletest-name) TEST(DARETest, IdentitySystem_ABQRN) { const Eigen::MatrixXd A{Eigen::Matrix2d::Identity()}; const Eigen::MatrixXd B{Eigen::Matrix2d::Identity()};