Bring declaration and initialization together

This commit is contained in:
kamilritz
2020-07-16 18:25:06 +02:00
committed by Mathieu Bresciani
parent 796afd5f98
commit e357376797
2 changed files with 12 additions and 16 deletions
+2 -3
View File
@@ -146,13 +146,10 @@ void Ekf::fuseGpsYaw()
_heading_innov_var += H_YAW[row] * PH[row];
}
float heading_innov_var_inv;
// check if the innovation variance calculation is badly conditioned
if (_heading_innov_var >= R_YAW) {
// the innovation variance contribution from the state covariances is not negative, no fault
_fault_status.flags.bad_hdg = false;
heading_innov_var_inv = 1.0f / _heading_innov_var;
} else {
// the innovation variance contribution from the state covariances is negative which means the covariance matrix is badly conditioned
@@ -164,6 +161,8 @@ void Ekf::fuseGpsYaw()
return;
}
const float heading_innov_var_inv = 1.f / _heading_innov_var;
// calculate the Kalman gains
// only calculate gains for states we are using
Vector24f Kfusion;