[wpimath] Remove unit suffixes from variable names (#7529)

* Move units into API docs instead because suffixes make user code verbose and hard to read
* Rename trackWidth to trackwidth
* Make ultrasonic classes use meters instead of a mix of m, cm, mm, ft,
  and inches
This commit is contained in:
Tyler Veness
2025-02-10 07:23:04 -08:00
committed by GitHub
parent 764ada9b66
commit ac1705ae2b
250 changed files with 2953 additions and 3584 deletions

View File

@@ -133,10 +133,10 @@ class AddressableLED {
* <p>By default, the driver is set up to drive WS2812B and WS2815, so nothing
* needs to be set for those.
*
* @param highTime0 high time for 0 bit (default 400ns)
* @param lowTime0 low time for 0 bit (default 900ns)
* @param highTime1 high time for 1 bit (default 900ns)
* @param lowTime1 low time for 1 bit (default 600ns)
* @param highTime0 high time for 0 bit (default 400 ns)
* @param lowTime0 low time for 0 bit (default 900 ns)
* @param highTime1 high time for 1 bit (default 900 ns)
* @param lowTime1 low time for 1 bit (default 600 ns)
*/
void SetBitTiming(units::nanosecond_t highTime0, units::nanosecond_t lowTime0,
units::nanosecond_t highTime1,

View File

@@ -63,10 +63,11 @@ class SharpIR : public wpi::Sendable, public wpi::SendableHelper<SharpIR> {
* @param channel Analog input channel the sensor is connected to
* @param a Constant A
* @param b Constant B
* @param minCM Minimum distance to report in centimeters
* @param maxCM Maximum distance to report in centimeters
* @param min Minimum distance to report
* @param max Maximum distance to report
*/
SharpIR(int channel, double a, double b, double minCM, double maxCM);
SharpIR(int channel, double a, double b, units::meter_t min,
units::meter_t max);
/**
* Get the analog input channel number.
@@ -80,7 +81,7 @@ class SharpIR : public wpi::Sendable, public wpi::SendableHelper<SharpIR> {
*
* @return range of the target returned by the sensor
*/
units::centimeter_t GetRange() const;
units::meter_t GetRange() const;
void InitSendable(wpi::SendableBuilder& builder) override;
@@ -92,8 +93,8 @@ class SharpIR : public wpi::Sendable, public wpi::SendableHelper<SharpIR> {
double m_A;
double m_B;
double m_minCM;
double m_maxCM;
units::meter_t m_min;
units::meter_t m_max;
};
} // namespace frc

View File

@@ -25,7 +25,7 @@ class DifferentialDrivetrainSim {
* system can be created with
* LinearSystemId::DrivetrainVelocitySystem() or
* LinearSystemId::IdentifyDrivetrainSystem().
* @param trackWidth The robot's track width.
* @param trackwidth The robot's trackwidth.
* @param driveMotor A DCMotor representing the left side of the drivetrain.
* @param gearingRatio The gearingRatio ratio of the left side, as output over
* input. This must be the same ratio as the ratio used to
@@ -41,7 +41,7 @@ class DifferentialDrivetrainSim {
* starting point.
*/
DifferentialDrivetrainSim(
LinearSystem<2, 2, 2> plant, units::meter_t trackWidth,
LinearSystem<2, 2, 2> plant, units::meter_t trackwidth,
DCMotor driveMotor, double gearingRatio, units::meter_t wheelRadius,
const std::array<double, 7>& measurementStdDevs = {});
@@ -56,7 +56,7 @@ class DifferentialDrivetrainSim {
* center.
* @param mass The mass of the drivebase.
* @param wheelRadius The radius of the wheels on the drivetrain.
* @param trackWidth The robot's track width, or distance between left and
* @param trackwidth The robot's trackwidth, or distance between left and
* right wheels.
* @param measurementStdDevs Standard deviations for measurements, in the form
* [x, y, heading, left velocity, right velocity,
@@ -70,7 +70,7 @@ class DifferentialDrivetrainSim {
DifferentialDrivetrainSim(
frc::DCMotor driveMotor, double gearing, units::kilogram_square_meter_t J,
units::kilogram_t mass, units::meter_t wheelRadius,
units::meter_t trackWidth,
units::meter_t trackwidth,
const std::array<double, 7>& measurementStdDevs = {});
/**

View File

@@ -31,9 +31,9 @@ class SharpIRSim {
/**
* Set the range returned by the distance sensor.
*
* @param rng range of the target returned by the sensor
* @param range range of the target returned by the sensor
*/
void SetRange(units::centimeter_t rng);
void SetRange(units::meter_t range);
private:
hal::SimDouble m_simRange;