mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[hal] Change usage reporting to string-based (#7763)
This commit is contained in:
@@ -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};
|
||||
}
|
||||
|
||||
@@ -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", "");
|
||||
}
|
||||
|
||||
@@ -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", "");
|
||||
}
|
||||
|
||||
@@ -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", "");
|
||||
}
|
||||
|
||||
@@ -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", "");
|
||||
}
|
||||
|
||||
@@ -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>>()};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user