mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpilib] Fix HolonomicDriveController atReference() behavior (#3163)
The atReference() method previously used the rotation error between the desired trajectory state and the current pose. This was a bug because we allow teams to use custom rotation setpoints and that wasn't being taken into account.
This commit is contained in:
committed by
GitHub
parent
fe5c2cf4b7
commit
f82aa1d564
@@ -19,7 +19,7 @@ HolonomicDriveController::HolonomicDriveController(
|
||||
|
||||
bool HolonomicDriveController::AtReference() const {
|
||||
const auto& eTranslate = m_poseError.Translation();
|
||||
const auto& eRotate = m_poseError.Rotation();
|
||||
const auto& eRotate = m_rotationError;
|
||||
const auto& tolTranslate = m_poseTolerance.Translation();
|
||||
const auto& tolRotate = m_poseTolerance.Rotation();
|
||||
return units::math::abs(eTranslate.X()) < tolTranslate.X() &&
|
||||
@@ -41,6 +41,7 @@ ChassisSpeeds HolonomicDriveController::Calculate(
|
||||
currentPose.Rotation().Radians(), angleRef.Radians()));
|
||||
|
||||
m_poseError = poseRef.RelativeTo(currentPose);
|
||||
m_rotationError = angleRef - currentPose.Rotation();
|
||||
|
||||
if (!m_enabled) {
|
||||
return ChassisSpeeds::FromFieldRelativeSpeeds(xFF, yFF, thetaFF,
|
||||
|
||||
Reference in New Issue
Block a user