From 56b6b7a778b973c4187e5df495614713b43603ce Mon Sep 17 00:00:00 2001 From: CarlOlsson Date: Fri, 8 Mar 2019 14:29:13 +0100 Subject: [PATCH] EKF: cleanup use of _mag_filt_state Signed-off-by: CarlOlsson --- EKF/ekf.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/EKF/ekf.cpp b/EKF/ekf.cpp index 6c4f47cb2c..03a00e28be 100644 --- a/EKF/ekf.cpp +++ b/EKF/ekf.cpp @@ -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