[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

@@ -20,7 +20,7 @@ class DefaultMathShared : public MathShared {
void ReportErrorV(fmt::string_view format, fmt::format_args args) override {}
void ReportWarningV(fmt::string_view format, fmt::format_args args) override {
}
void ReportUsage(MathUsageId id, int count) override {}
void ReportUsage(std::string_view resource, std::string_view data) override {}
units::second_t GetTimestamp() override {
return units::second_t{wpi::Now() * 1.0e-6};
}

View File

@@ -13,6 +13,5 @@ DifferentialDriveOdometry::DifferentialDriveOdometry(
units::meter_t rightDistance, const Pose2d& initialPose)
: Odometry(m_kinematicsImpl, gyroAngle, {leftDistance, rightDistance},
initialPose) {
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kOdometry_DifferentialDrive, 1);
wpi::math::MathSharedStore::ReportUsage("DifferentialDriveOdometry", "");
}

View File

@@ -13,6 +13,5 @@ DifferentialDriveOdometry3d::DifferentialDriveOdometry3d(
units::meter_t rightDistance, const Pose3d& initialPose)
: Odometry3d(m_kinematicsImpl, gyroAngle, {leftDistance, rightDistance},
initialPose) {
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kOdometry_DifferentialDrive, 1);
wpi::math::MathSharedStore::ReportUsage("DifferentialDriveOdometry3d", "");
}

View File

@@ -13,6 +13,5 @@ MecanumDriveOdometry::MecanumDriveOdometry(
const MecanumDriveWheelPositions& wheelPositions, const Pose2d& initialPose)
: Odometry(m_kinematicsImpl, gyroAngle, wheelPositions, initialPose),
m_kinematicsImpl(kinematics) {
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kOdometry_MecanumDrive, 1);
wpi::math::MathSharedStore::ReportUsage("MecanumDriveOdometry", "");
}

View File

@@ -13,6 +13,5 @@ MecanumDriveOdometry3d::MecanumDriveOdometry3d(
const MecanumDriveWheelPositions& wheelPositions, const Pose3d& initialPose)
: Odometry3d(m_kinematicsImpl, gyroAngle, wheelPositions, initialPose),
m_kinematicsImpl(kinematics) {
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kOdometry_MecanumDrive, 1);
wpi::math::MathSharedStore::ReportUsage("MecanumDriveOdometry3d", "");
}

View File

@@ -37,8 +37,7 @@ Trajectory TrajectoryUtil::FromPathweaverJson(std::string_view path) {
wpi::json json = wpi::json::parse(fileBuffer.value()->GetCharBuffer());
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kTrajectory_PathWeaver,
++pathWeaverTrajectoryInstances);
"Trajectory.PathWeaver", std::to_string(++pathWeaverTrajectoryInstances));
return Trajectory{json.get<std::vector<Trajectory::State>>()};
}