[wpilib] Rename NormalizeWheelSpeeds to DesaturateWheelSpeeds (#3791)

This commit is contained in:
Oblarg
2021-12-30 21:30:08 -05:00
committed by GitHub
parent 102f23bbdb
commit b8d019cdb4
44 changed files with 104 additions and 94 deletions

View File

@@ -160,9 +160,9 @@ class MecanumDriveKinematicsTest {
}
@Test
void testNormalize() {
void testDesaturate() {
var wheelSpeeds = new MecanumDriveWheelSpeeds(5, 6, 4, 7);
wheelSpeeds.normalize(5.5);
wheelSpeeds.desaturate(5.5);
double factor = 5.5 / 7.0;

View File

@@ -229,14 +229,14 @@ class SwerveDriveKinematicsTest {
}
@Test
void testNormalize() {
void testDesaturate() {
SwerveModuleState fl = new SwerveModuleState(5, new Rotation2d());
SwerveModuleState fr = new SwerveModuleState(6, new Rotation2d());
SwerveModuleState bl = new SwerveModuleState(4, new Rotation2d());
SwerveModuleState br = new SwerveModuleState(7, new Rotation2d());
SwerveModuleState[] arr = {fl, fr, bl, br};
SwerveDriveKinematics.normalizeWheelSpeeds(arr, 5.5);
SwerveDriveKinematics.desaturateWheelSpeeds(arr, 5.5);
double factor = 5.5 / 7.0;

View File

@@ -143,9 +143,9 @@ TEST_F(MecanumDriveKinematicsTest,
EXPECT_NEAR(0.707, chassisSpeeds.omega.value(), 0.1);
}
TEST_F(MecanumDriveKinematicsTest, Normalize) {
TEST_F(MecanumDriveKinematicsTest, Desaturate) {
MecanumDriveWheelSpeeds wheelSpeeds{5_mps, 6_mps, 4_mps, 7_mps};
wheelSpeeds.Normalize(5.5_mps);
wheelSpeeds.Desaturate(5.5_mps);
double kFactor = 5.5 / 7.0;

View File

@@ -162,14 +162,14 @@ TEST_F(SwerveDriveKinematicsTest,
EXPECT_NEAR(chassisSpeeds.omega.value(), 1.5, kEpsilon);
}
TEST_F(SwerveDriveKinematicsTest, Normalize) {
TEST_F(SwerveDriveKinematicsTest, Desaturate) {
SwerveModuleState state1{5.0_mps, Rotation2d()};
SwerveModuleState state2{6.0_mps, Rotation2d()};
SwerveModuleState state3{4.0_mps, Rotation2d()};
SwerveModuleState state4{7.0_mps, Rotation2d()};
wpi::array<SwerveModuleState, 4> arr{state1, state2, state3, state4};
SwerveDriveKinematics<4>::NormalizeWheelSpeeds(&arr, 5.5_mps);
SwerveDriveKinematics<4>::DesaturateWheelSpeeds(&arr, 5.5_mps);
double kFactor = 5.5 / 7.0;