mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-21 16:18:29 -04:00
AP_AHRS: restore DCM attitude before update()
The DCM drift correction code uses the current attitude to calculate error values to update its gyro drift correction. If we were using EKF then without this patch the DCM code running as an alternative AHRS source would be using the EKF attitude for calculating the error value, leading to very bad gyro drift estimation
This commit is contained in:
parent
63c06ea2af
commit
eec5cd5add
@ -52,6 +52,16 @@ const Vector3f &AP_AHRS_NavEKF::get_gyro_drift(void) const
|
||||
|
||||
void AP_AHRS_NavEKF::update(void)
|
||||
{
|
||||
// we need to restore the old DCM attitude values as these are
|
||||
// used internally in DCM to calculate error values for gyro drift
|
||||
// correction
|
||||
roll = _dcm_attitude.x;
|
||||
pitch = _dcm_attitude.y;
|
||||
yaw = _dcm_attitude.z;
|
||||
roll_sensor = degrees(roll)*100;
|
||||
pitch_sensor = degrees(pitch)*100;
|
||||
yaw_sensor = degrees(yaw)*100;
|
||||
|
||||
AP_AHRS_DCM::update();
|
||||
|
||||
// keep DCM attitude available for get_secondary_attitude()
|
||||
|
Loading…
Reference in New Issue
Block a user