ekf2: move gps yaw reset in starting function

This commit is contained in:
bresch
2021-10-25 14:01:08 +02:00
committed by Mathieu Bresciani
parent 1461eb0e32
commit 9afc390552
2 changed files with 12 additions and 8 deletions
+3 -3
View File
@@ -820,10 +820,10 @@ void Ekf::controlGpsYawFusion(bool gps_checks_passing, bool gps_checks_failing)
} else { } else {
if (starting_conditions_passing) { if (starting_conditions_passing) {
// Try to activate GPS yaw fusion // Try to activate GPS yaw fusion
if (resetYawToGps()) { startGpsYawFusion();
_control_status.flags.yaw_align = true;
if (_control_status.flags.gps_yaw) {
_nb_gps_yaw_reset_available = 1; _nb_gps_yaw_reset_available = 1;
startGpsYawFusion();
} }
} }
} }
+9 -5
View File
@@ -1546,11 +1546,15 @@ void Ekf::stopGpsVelFusion()
void Ekf::startGpsYawFusion() void Ekf::startGpsYawFusion()
{ {
_control_status.flags.mag_dec = false; if (resetYawToGps()) {
stopEvYawFusion(); _control_status.flags.yaw_align = true;
stopMagHdgFusion(); _control_status.flags.mag_dec = false;
stopMag3DFusion(); stopEvYawFusion();
_control_status.flags.gps_yaw = true; stopMagHdgFusion();
stopMag3DFusion();
_control_status.flags.gps_yaw = true;
}
} }
void Ekf::stopGpsYawFusion() void Ekf::stopGpsYawFusion()