[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

@@ -9,7 +9,7 @@
#include <string>
#include <utility>
#include <hal/FRCUsageReporting.h>
#include <hal/UsageReporting.h>
#include <wpi/sendable/SendableBuilder.h>
#include <wpi/sendable/SendableRegistry.h>
@@ -42,8 +42,7 @@ void DifferentialDrive::ArcadeDrive(double xSpeed, double zRotation,
bool squareInputs) {
static bool reported = false;
if (!reported) {
HAL_Report(HALUsageReporting::kResourceType_RobotDrive,
HALUsageReporting::kRobotDrive2_DifferentialArcade, 2);
HAL_ReportUsage("RobotDrive", "DifferentialArcade");
reported = true;
}
@@ -65,8 +64,7 @@ void DifferentialDrive::CurvatureDrive(double xSpeed, double zRotation,
bool allowTurnInPlace) {
static bool reported = false;
if (!reported) {
HAL_Report(HALUsageReporting::kResourceType_RobotDrive,
HALUsageReporting::kRobotDrive2_DifferentialCurvature, 2);
HAL_ReportUsage("RobotDrive", "DifferentialCurvature");
reported = true;
}
@@ -88,8 +86,7 @@ void DifferentialDrive::TankDrive(double leftSpeed, double rightSpeed,
bool squareInputs) {
static bool reported = false;
if (!reported) {
HAL_Report(HALUsageReporting::kResourceType_RobotDrive,
HALUsageReporting::kRobotDrive2_DifferentialTank, 2);
HAL_ReportUsage("RobotDrive", "DifferentialTank");
reported = true;
}

View File

@@ -8,7 +8,7 @@
#include <string>
#include <utility>
#include <hal/FRCUsageReporting.h>
#include <hal/UsageReporting.h>
#include <wpi/sendable/SendableBuilder.h>
#include <wpi/sendable/SendableRegistry.h>
@@ -52,8 +52,7 @@ MecanumDrive::MecanumDrive(std::function<void(double)> frontLeftMotor,
void MecanumDrive::DriveCartesian(double xSpeed, double ySpeed,
double zRotation, Rotation2d gyroAngle) {
if (!reported) {
HAL_Report(HALUsageReporting::kResourceType_RobotDrive,
HALUsageReporting::kRobotDrive2_MecanumCartesian, 4);
HAL_ReportUsage("RobotDrive", "MecanumCartesian");
reported = true;
}
@@ -79,8 +78,7 @@ void MecanumDrive::DriveCartesian(double xSpeed, double ySpeed,
void MecanumDrive::DrivePolar(double magnitude, Rotation2d angle,
double zRotation) {
if (!reported) {
HAL_Report(HALUsageReporting::kResourceType_RobotDrive,
HALUsageReporting::kRobotDrive2_MecanumPolar, 4);
HAL_ReportUsage("RobotDrive", "MecanumPolar");
reported = true;
}

View File

@@ -8,8 +8,6 @@
#include <cmath>
#include <cstddef>
#include <hal/FRCUsageReporting.h>
#include "frc/motorcontrol/MotorController.h"
using namespace frc;