[hal] Change usage reporting to string-based (#7763)

This commit is contained in:
Peter Johnson
2025-02-07 12:37:23 -08:00
committed by GitHub
parent bfff891b5c
commit 764ada9b66
188 changed files with 637 additions and 2298 deletions

View File

@@ -45,8 +45,8 @@ class WPILIB_DLLEXPORT BangBangController
: m_tolerance(tolerance) {
if (!std::is_constant_evaluated()) {
++instances;
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kController_BangBangController, instances);
wpi::math::MathSharedStore::ReportUsage("BangBangController",
std::to_string(instances));
}
}

View File

@@ -74,8 +74,8 @@ class WPILIB_DLLEXPORT PIDController
if (!std::is_constant_evaluated()) {
++instances;
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kController_PIDController2, instances);
wpi::math::MathSharedStore::ReportUsage("PIDController",
std::to_string(instances));
wpi::SendableRegistry::Add(this, "PIDController", instances);
}
}

View File

@@ -63,8 +63,8 @@ class ProfiledPIDController
m_profile{m_constraints} {
if (!std::is_constant_evaluated()) {
int instances = detail::IncrementAndGetProfiledPIDControllerInstances();
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kController_ProfiledPIDController, instances);
wpi::math::MathSharedStore::ReportUsage("ProfiledPIDController",
std::to_string(instances));
wpi::SendableRegistry::Add(this, "ProfiledPIDController", instances);
}
}

View File

@@ -96,8 +96,8 @@ class LinearFilter {
if (!std::is_constant_evaluated()) {
++instances;
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kFilter_Linear, instances);
wpi::math::MathSharedStore::ReportUsage("LinearFilter",
std::to_string(instances));
}
}

View File

@@ -41,8 +41,8 @@ class WPILIB_DLLEXPORT DifferentialDriveKinematics
constexpr explicit DifferentialDriveKinematics(units::meter_t trackWidth)
: trackWidth(trackWidth) {
if (!std::is_constant_evaluated()) {
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kKinematics_DifferentialDrive, 1);
wpi::math::MathSharedStore::ReportUsage("DifferentialDriveKinematics",
"");
}
}

View File

@@ -66,8 +66,7 @@ class WPILIB_DLLEXPORT MecanumDriveKinematics
SetInverseKinematics(frontLeftWheel, frontRightWheel, rearLeftWheel,
rearRightWheel);
m_forwardKinematics = m_inverseKinematics.householderQr();
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kKinematics_MecanumDrive, 1);
wpi::math::MathSharedStore::ReportUsage("MecanumDriveKinematics", "");
}
MecanumDriveKinematics(const MecanumDriveKinematics&) = default;

View File

@@ -78,8 +78,7 @@ class SwerveDriveKinematics
m_forwardKinematics = m_inverseKinematics.householderQr();
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kKinematics_SwerveDrive, 1);
wpi::math::MathSharedStore::ReportUsage("SwerveDriveKinematics", "");
}
explicit SwerveDriveKinematics(
@@ -95,8 +94,7 @@ class SwerveDriveKinematics
m_forwardKinematics = m_inverseKinematics.householderQr();
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kKinematics_SwerveDrive, 1);
wpi::math::MathSharedStore::ReportUsage("Kinematics_SwerveDrive", "");
}
SwerveDriveKinematics(const SwerveDriveKinematics&) = default;

View File

@@ -48,8 +48,7 @@ class SwerveDriveOdometry
: SwerveDriveOdometry::Odometry(m_kinematicsImpl, gyroAngle,
modulePositions, initialPose),
m_kinematicsImpl(kinematics) {
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kOdometry_SwerveDrive, 1);
wpi::math::MathSharedStore::ReportUsage("SwerveDriveOdometry", "");
}
private:

View File

@@ -53,8 +53,7 @@ class SwerveDriveOdometry3d
: SwerveDriveOdometry3d::Odometry3d(m_kinematicsImpl, gyroAngle,
modulePositions, initialPose),
m_kinematicsImpl(kinematics) {
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kOdometry_SwerveDrive, 1);
wpi::math::MathSharedStore::ReportUsage("SwerveDriveOdometry3d", "");
}
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop

View File

@@ -69,8 +69,7 @@ class TrapezoidProfile {
*/
constexpr Constraints() {
if (!std::is_constant_evaluated()) {
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kTrajectory_TrapezoidProfile, 1);
wpi::math::MathSharedStore::ReportUsage("TrapezoidProfile", "");
}
}
@@ -84,8 +83,7 @@ class TrapezoidProfile {
Acceleration_t maxAcceleration)
: maxVelocity{maxVelocity}, maxAcceleration{maxAcceleration} {
if (!std::is_constant_evaluated()) {
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kTrajectory_TrapezoidProfile, 1);
wpi::math::MathSharedStore::ReportUsage("TrapezoidProfile", "");
}
}
};