mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
Add usage reporting for many new things (#2184)
- new CommandScheduler - kinematics and odometry classes - new PIDController - ProfiledPIDController - TrapezoidProfile (reported in Constraints class) Also update instances.txt to match latest NI version. One side effect is that a couple of classes are no longer constexpr.
This commit is contained in:
@@ -21,6 +21,9 @@
|
||||
#include "frc/trajectory/TrapezoidProfile.h"
|
||||
|
||||
namespace frc {
|
||||
namespace detail {
|
||||
void ReportProfiledPIDController();
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* Implements a PID control loop whose setpoint is constrained by a trapezoid
|
||||
@@ -54,7 +57,9 @@ class ProfiledPIDController
|
||||
*/
|
||||
ProfiledPIDController(double Kp, double Ki, double Kd,
|
||||
Constraints constraints, units::second_t period = 20_ms)
|
||||
: m_controller(Kp, Ki, Kd, period), m_constraints(constraints) {}
|
||||
: m_controller(Kp, Ki, Kd, period), m_constraints(constraints) {
|
||||
detail::ReportProfiledPIDController();
|
||||
}
|
||||
|
||||
~ProfiledPIDController() override = default;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <units/units.h>
|
||||
|
||||
#include "frc/kinematics/ChassisSpeeds.h"
|
||||
@@ -31,8 +32,11 @@ class DifferentialDriveKinematics {
|
||||
* empirical value may be larger than the physical measured value due to
|
||||
* scrubbing effects.
|
||||
*/
|
||||
constexpr explicit DifferentialDriveKinematics(units::meter_t trackWidth)
|
||||
: trackWidth(trackWidth) {}
|
||||
explicit DifferentialDriveKinematics(units::meter_t trackWidth)
|
||||
: trackWidth(trackWidth) {
|
||||
HAL_Report(HALUsageReporting::kResourceType_Kinematics,
|
||||
HALUsageReporting::kKinematics_DifferentialDrive);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a chassis speed from left and right component velocities using
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/QR>
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
|
||||
#include "frc/geometry/Translation2d.h"
|
||||
#include "frc/kinematics/ChassisSpeeds.h"
|
||||
@@ -63,6 +64,8 @@ class MecanumDriveKinematics {
|
||||
SetInverseKinematics(frontLeftWheel, frontRightWheel, rearLeftWheel,
|
||||
rearRightWheel);
|
||||
m_forwardKinematics = m_inverseKinematics.householderQr();
|
||||
HAL_Report(HALUsageReporting::kResourceType_Kinematics,
|
||||
HALUsageReporting::kKinematics_MecanumDrive);
|
||||
}
|
||||
|
||||
MecanumDriveKinematics(const MecanumDriveKinematics&) = default;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/QR>
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <units/units.h>
|
||||
|
||||
#include "frc/geometry/Rotation2d.h"
|
||||
@@ -71,6 +72,9 @@ class SwerveDriveKinematics {
|
||||
}
|
||||
|
||||
m_forwardKinematics = m_inverseKinematics.householderQr();
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_Kinematics,
|
||||
HALUsageReporting::kKinematics_SwerveDrive);
|
||||
}
|
||||
|
||||
SwerveDriveKinematics(const SwerveDriveKinematics&) = default;
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
|
||||
namespace frc {
|
||||
template <size_t NumModules>
|
||||
SwerveDriveOdometry<NumModules>::SwerveDriveOdometry(
|
||||
@@ -15,6 +17,8 @@ SwerveDriveOdometry<NumModules>::SwerveDriveOdometry(
|
||||
: m_kinematics(kinematics), m_pose(initialPose) {
|
||||
m_previousAngle = m_pose.Rotation();
|
||||
m_gyroOffset = m_pose.Rotation() - gyroAngle;
|
||||
HAL_Report(HALUsageReporting::kResourceType_Odometry,
|
||||
HALUsageReporting::kOdometry_SwerveDrive);
|
||||
}
|
||||
|
||||
template <size_t NumModules>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <units/units.h>
|
||||
|
||||
namespace frc {
|
||||
@@ -53,6 +54,13 @@ class TrapezoidProfile {
|
||||
public:
|
||||
class Constraints {
|
||||
public:
|
||||
Constraints() {
|
||||
HAL_Report(HALUsageReporting::kResourceType_TrapezoidProfile, 1);
|
||||
}
|
||||
Constraints(Velocity_t maxVelocity_, Acceleration_t maxAcceleration_)
|
||||
: maxVelocity{maxVelocity_}, maxAcceleration{maxAcceleration_} {
|
||||
HAL_Report(HALUsageReporting::kResourceType_TrapezoidProfile, 1);
|
||||
}
|
||||
Velocity_t maxVelocity{0};
|
||||
Acceleration_t maxAcceleration{0};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user