EKF: Add simple control logic for magnetic declination constraint

This commit is contained in:
Paul Riseborough 2016-02-08 14:15:41 +11:00
parent dbb8e12948
commit cdc42c1de0

View File

@ -109,6 +109,13 @@ void Ekf::controlFusionModes()
_control_status.flags.mag_3D = false;
}
}
// if we are using 3-axis magnetometer fusion, but without external aiding, then the declination needs to be fused as an observation to prevent long term heading drift
if(_control_status.flags.mag_3D && _control_status.flags.gps) {
_control_status.flags.mag_dec = false;
} else {
_control_status.flags.mag_dec = true;
}
}
void Ekf::calculateVehicleStatus()