mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpimath] SwerveDriveKinematics: Rename currentChassisSpeed to desiredChassisSpeed (#5393)
This commit is contained in:
@@ -271,7 +271,7 @@ class SwerveDriveKinematics
|
||||
*
|
||||
* @param moduleStates Reference to array of module states. The array will be
|
||||
* mutated with the normalized speeds!
|
||||
* @param currentChassisSpeed Current speed of the robot
|
||||
* @param desiredChassisSpeed The desired speed of the robot
|
||||
* @param attainableMaxModuleSpeed The absolute max speed a module can reach
|
||||
* @param attainableMaxRobotTranslationSpeed The absolute max speed the robot
|
||||
* can reach while translating
|
||||
@@ -280,7 +280,7 @@ class SwerveDriveKinematics
|
||||
*/
|
||||
static void DesaturateWheelSpeeds(
|
||||
wpi::array<SwerveModuleState, NumModules>* moduleStates,
|
||||
ChassisSpeeds currentChassisSpeed,
|
||||
ChassisSpeeds desiredChassisSpeed,
|
||||
units::meters_per_second_t attainableMaxModuleSpeed,
|
||||
units::meters_per_second_t attainableMaxRobotTranslationSpeed,
|
||||
units::radians_per_second_t attainableMaxRobotRotationSpeed);
|
||||
|
||||
@@ -137,7 +137,7 @@ void SwerveDriveKinematics<NumModules>::DesaturateWheelSpeeds(
|
||||
template <size_t NumModules>
|
||||
void SwerveDriveKinematics<NumModules>::DesaturateWheelSpeeds(
|
||||
wpi::array<SwerveModuleState, NumModules>* moduleStates,
|
||||
ChassisSpeeds currentChassisSpeed,
|
||||
ChassisSpeeds desiredChassisSpeed,
|
||||
units::meters_per_second_t attainableMaxModuleSpeed,
|
||||
units::meters_per_second_t attainableMaxRobotTranslationSpeed,
|
||||
units::radians_per_second_t attainableMaxRobotRotationSpeed) {
|
||||
@@ -157,10 +157,10 @@ void SwerveDriveKinematics<NumModules>::DesaturateWheelSpeeds(
|
||||
}
|
||||
|
||||
auto translationalK =
|
||||
units::math::hypot(currentChassisSpeed.vx, currentChassisSpeed.vy) /
|
||||
units::math::hypot(desiredChassisSpeed.vx, desiredChassisSpeed.vy) /
|
||||
attainableMaxRobotTranslationSpeed;
|
||||
|
||||
auto rotationalK = units::math::abs(currentChassisSpeed.omega) /
|
||||
auto rotationalK = units::math::abs(desiredChassisSpeed.omega) /
|
||||
attainableMaxRobotRotationSpeed;
|
||||
|
||||
auto k = units::math::max(translationalK, rotationalK);
|
||||
|
||||
Reference in New Issue
Block a user