[wpimath] Fix order of setting gyro offset in pose estimators (#3176)

The gyro offset should be determined from the desired initial pose, not the current pose. This fix reflects the behavior of the odometry classes and the C++ holonomic pose estimators.
This commit is contained in:
Claudius Tewari
2021-02-16 18:04:38 -08:00
committed by GitHub
parent d241bc81ae
commit d1c7032dec
4 changed files with 4 additions and 4 deletions

View File

@@ -56,8 +56,8 @@ void DifferentialDrivePoseEstimator::SetVisionMeasurementStdDevs(
void DifferentialDrivePoseEstimator::ResetPosition(
const Pose2d& pose, const Rotation2d& gyroAngle) {
m_previousAngle = pose.Rotation();
m_gyroOffset = GetEstimatedPosition().Rotation() - gyroAngle;
m_observer.SetXhat(FillStateVector(pose, 0_m, 0_m));
m_gyroOffset = GetEstimatedPosition().Rotation() - gyroAngle;
}
Pose2d DifferentialDrivePoseEstimator::GetEstimatedPosition() const {