mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
[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:
@@ -10,14 +10,14 @@
|
||||
namespace sysid {
|
||||
|
||||
/**
|
||||
* Calculates the track width given the left distance, right distance, and
|
||||
* Calculates the trackwidth given the left distance, right distance, and
|
||||
* accumulated gyro angle.
|
||||
*
|
||||
* @param l The distance traveled by the left side of the drivetrain.
|
||||
* @param r The distance traveled by the right side of the drivetrain.
|
||||
* @param accum The accumulated gyro angle.
|
||||
*/
|
||||
constexpr double CalculateTrackWidth(double l, double r,
|
||||
constexpr double CalculateTrackwidth(double l, double r,
|
||||
units::radian_t accum) {
|
||||
// The below comes from solving ω = (vr − vl) / 2r for 2r.
|
||||
return (gcem::abs(r) + gcem::abs(l)) / gcem::abs(accum.value());
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "sysid/analysis/TrackWidthAnalysis.h"
|
||||
#include "sysid/analysis/TrackwidthAnalysis.h"
|
||||
|
||||
TEST(TrackWidthAnalysisTest, Calculate) {
|
||||
double result = sysid::CalculateTrackWidth(-0.5386, 0.5386, 90_deg);
|
||||
TEST(TrackwidthAnalysisTest, Calculate) {
|
||||
double result = sysid::CalculateTrackwidth(-0.5386, 0.5386, 90_deg);
|
||||
EXPECT_NEAR(result, 0.6858, 1E-4);
|
||||
}
|
||||
Reference in New Issue
Block a user