mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 01:03:34 +08:00
ekf2: allow initialization without baro data when fusion is disabled
This commit is contained in:
@@ -161,29 +161,32 @@ bool Ekf::initialiseFilter()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// accumulate enough height measurements to be confident in the quality of the data
|
// accumulate enough height measurements to be confident in the quality of the data
|
||||||
if (_baro_buffer && _baro_buffer->pop_first_older_than(_imu_sample_delayed.time_us, &_baro_sample_delayed)) {
|
if (_baro_buffer) {
|
||||||
if (_baro_sample_delayed.time_us != 0) {
|
baroSample baro_sample;
|
||||||
if (_baro_counter == 0) {
|
|
||||||
_baro_lpf.reset(_baro_sample_delayed.hgt);
|
|
||||||
|
|
||||||
} else {
|
if (_baro_buffer->pop_first_older_than(_imu_sample_delayed.time_us, &baro_sample)) {
|
||||||
_baro_lpf.update(_baro_sample_delayed.hgt);
|
if (baro_sample.time_us != 0) {
|
||||||
|
if (_baro_counter == 0) {
|
||||||
|
_baro_lpf.reset(baro_sample.hgt);
|
||||||
|
|
||||||
_baro_b_est.setBias(_baro_lpf.getState());
|
} else {
|
||||||
|
_baro_lpf.update(baro_sample.hgt);
|
||||||
|
|
||||||
|
_baro_b_est.setBias(_baro_lpf.getState());
|
||||||
|
}
|
||||||
|
|
||||||
|
_baro_counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
_baro_counter++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_baro_counter < _obs_buffer_length) {
|
if (_params.baro_ctrl != 0) {
|
||||||
// not enough baro samples accumulated
|
if (_baro_counter < _obs_buffer_length) {
|
||||||
return false;
|
// not enough baro samples accumulated
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we use baro height initially and switch to GPS/range/EV finder later when it passes checks.
|
|
||||||
_control_status.flags.baro_hgt = false;
|
|
||||||
|
|
||||||
if (!initialiseTilt()) {
|
if (!initialiseTilt()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user