mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilib] Rename NormalizeWheelSpeeds to DesaturateWheelSpeeds (#3791)
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
void DifferentialDriveWheelSpeeds::Normalize(
|
||||
void DifferentialDriveWheelSpeeds::Desaturate(
|
||||
units::meters_per_second_t attainableMaxSpeed) {
|
||||
auto realMaxSpeed =
|
||||
units::math::max(units::math::abs(left), units::math::abs(right));
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
void MecanumDriveWheelSpeeds::Normalize(
|
||||
void MecanumDriveWheelSpeeds::Desaturate(
|
||||
units::meters_per_second_t attainableMaxSpeed) {
|
||||
std::array<units::meters_per_second_t, 4> wheelSpeeds{frontLeft, frontRight,
|
||||
rearLeft, rearRight};
|
||||
|
||||
@@ -16,7 +16,7 @@ units::meters_per_second_t DifferentialDriveKinematicsConstraint::MaxVelocity(
|
||||
units::meters_per_second_t velocity) const {
|
||||
auto wheelSpeeds =
|
||||
m_kinematics.ToWheelSpeeds({velocity, 0_mps, velocity * curvature});
|
||||
wheelSpeeds.Normalize(m_maxSpeed);
|
||||
wheelSpeeds.Desaturate(m_maxSpeed);
|
||||
|
||||
return m_kinematics.ToChassisSpeeds(wheelSpeeds).vx;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ units::meters_per_second_t MecanumDriveKinematicsConstraint::MaxVelocity(
|
||||
auto yVelocity = velocity * pose.Rotation().Sin();
|
||||
auto wheelSpeeds =
|
||||
m_kinematics.ToWheelSpeeds({xVelocity, yVelocity, velocity * curvature});
|
||||
wheelSpeeds.Normalize(m_maxSpeed);
|
||||
wheelSpeeds.Desaturate(m_maxSpeed);
|
||||
|
||||
auto normSpeeds = m_kinematics.ToChassisSpeeds(wheelSpeeds);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user