Skip to content

Commit b1ca049

Browse files
dagarbresch
authored andcommitted
ekf2: yaw estimator additional validity checks
1 parent 1eb9434 commit b1ca049

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/modules/ekf2/EKF/aid_sources/gnss/gps_control.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,11 @@ bool Ekf::isYawEmergencyEstimateAvailable() const
393393
return false;
394394
}
395395

396-
return _yawEstimator.getYawVar() < sq(_params.EKFGSF_yaw_err_max);
396+
const float yaw_var = _yawEstimator.getYawVar();
397+
398+
return (yaw_var > 0.f)
399+
&& (yaw_var < sq(_params.EKFGSF_yaw_err_max))
400+
&& PX4_ISFINITE(yaw_var);
397401
}
398402

399403
bool Ekf::isYawFailure() const

src/modules/ekf2/EKF/yaw_estimator/EKFGSF_yaw.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ void EKFGSF_yaw::fuseVelocity(const Vector2f &vel_NE, const float vel_accuracy,
167167
const float yaw_delta = wrap_pi(_ekf_gsf[model_index].X(2) - _gsf_yaw);
168168
_gsf_yaw_variance += _model_weights(model_index) * (_ekf_gsf[model_index].P(2, 2) + yaw_delta * yaw_delta);
169169
}
170+
171+
if (_gsf_yaw_variance <= 0.f || !PX4_ISFINITE(_gsf_yaw_variance)) {
172+
reset();
173+
}
170174
}
171175
}
172176

0 commit comments

Comments
 (0)