mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpimath] SwerveDrivePoseEstimator: Fix stationary module emitting error when calculating angle in ToSwerveModuleStates (#7175)
This commit is contained in:
@@ -66,7 +66,8 @@ SwerveDriveKinematics<NumModules>::ToSwerveModuleStates(
|
||||
units::meters_per_second_t y{moduleStateMatrix(i * 2 + 1, 0)};
|
||||
|
||||
auto speed = units::math::hypot(x, y);
|
||||
Rotation2d rotation{x.value(), y.value()};
|
||||
auto rotation = speed > 1e-6_mps ? Rotation2d{x.value(), y.value()}
|
||||
: m_moduleHeadings[i];
|
||||
|
||||
moduleStates[i] = {speed, rotation};
|
||||
m_moduleHeadings[i] = rotation;
|
||||
|
||||
Reference in New Issue
Block a user