mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-19 05:09:07 +08:00
Merge pull request #2615 from Zefz/nan-protect
attitude_estimator_q: Fix NaN protection
This commit is contained in:
commit
f226e808b2
@ -268,7 +268,7 @@ void AttitudeEstimatorQ::task_main() {
|
||||
}
|
||||
}
|
||||
|
||||
if (_acc_comp && _gpos.timestamp != 0 && hrt_absolute_time() < _gpos.timestamp + 20000 && _gpos.eph < 5.0f) {
|
||||
if (_acc_comp && _gpos.timestamp != 0 && hrt_absolute_time() < _gpos.timestamp + 20000 && _gpos.eph < 5.0f && _inited) {
|
||||
/* position data is actual */
|
||||
if (gpos_updated) {
|
||||
Vector<3> vel(_gpos.vel_n, _gpos.vel_e, _gpos.vel_d);
|
||||
@ -450,6 +450,8 @@ bool AttitudeEstimatorQ::update(float dt) {
|
||||
PX4_ISFINITE(_q(2)) && PX4_ISFINITE(_q(3)))) {
|
||||
// Reset quaternion to last good state
|
||||
_q = q_last;
|
||||
_rates.zero();
|
||||
_gyro_bias.zero();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user