mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-15 15:17:35 +08:00
Ekf: extract baro height offset computation
This commit is contained in:
committed by
Mathieu Bresciani
parent
6b64cf0770
commit
30d69aa45b
+1
-10
@@ -1050,16 +1050,7 @@ void Ekf::controlHeightFusion()
|
||||
break;
|
||||
}
|
||||
|
||||
// calculate a filtered offset between the baro origin and local NED origin if we are not using the baro as a height reference
|
||||
if (!_control_status.flags.baro_hgt && _baro_data_ready) {
|
||||
float local_time_step = 1e-6f * _delta_time_baro_us;
|
||||
local_time_step = math::constrain(local_time_step, 0.0f, 1.0f);
|
||||
|
||||
// apply a 10 second first order low pass filter to baro offset
|
||||
float offset_rate_correction = 0.1f * (_baro_sample_delayed.hgt + _state.pos(
|
||||
2) - _baro_hgt_offset);
|
||||
_baro_hgt_offset += local_time_step * math::constrain(offset_rate_correction, -0.1f, 0.1f);
|
||||
}
|
||||
updateBaroHgtOffset();
|
||||
|
||||
if (isTimedOut(_time_last_hgt_fuse, 2 * RNG_MAX_INTERVAL) && _control_status.flags.rng_hgt
|
||||
&& (!_range_sensor.isDataHealthy())) {
|
||||
|
||||
Reference in New Issue
Block a user