EKF: cleanup use of _mag_filt_state

Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
This commit is contained in:
CarlOlsson
2019-03-12 19:07:55 +11:00
committed by Paul Riseborough
parent 37339de57c
commit 56b6b7a778
+1 -4
View File
@@ -256,13 +256,10 @@ bool Ekf::initialiseFilter()
// update transformation matrix from body to world frame
_R_to_earth = quat_to_invrotmat(_state.quat_nominal);
// calculate the averaged magnetometer reading
Vector3f mag_init = _mag_filt_state;
// calculate the initial magnetic field and yaw alignment
// Get the magnetic declination
calcMagDeclination();
_control_status.flags.yaw_align = resetMagHeading(mag_init);
_control_status.flags.yaw_align = resetMagHeading(_mag_filt_state);
if (_control_status.flags.rng_hgt) {
// if we are using the range finder as the primary source, then calculate the baro height at origin so we can use baro as a backup