Add parameter for terrain timeout

This commit is contained in:
Morten Fyhn Amundsen 2021-03-10 16:52:10 +01:00 committed by Mathieu Bresciani
parent 4df0054873
commit ab69681744
2 changed files with 3 additions and 1 deletions

View File

@ -243,6 +243,7 @@ struct parameters {
float wind_vel_p_noise_scaler{0.5f}; ///< scaling of wind process noise with vertical velocity
float terrain_p_noise{5.0f}; ///< process noise for terrain offset (m/sec)
float terrain_gradient{0.5f}; ///< gradient of terrain used to estimate process noise due to changing position (m/m)
float terrain_timeout{10.f}; ///< maximum time for invalid bottom distance measurements before resetting terrain estimate (s)
// initialization errors
float switch_on_gyro_bias{0.1f}; ///< 1-sigma gyro bias uncertainty at switch on (rad/sec)

View File

@ -166,7 +166,8 @@ void Ekf::fuseHagl()
} else {
// If we have been rejecting range data for too long, reset to measurement
if (isTimedOut(_time_last_hagl_fuse, (uint64_t)10E6)) {
const uint64_t timeout = static_cast<uint64_t>(_params.terrain_timeout * 1e6f);
if (isTimedOut(_time_last_hagl_fuse, timeout)) {
_terrain_vpos = _state.pos(2) + meas_hagl;
_terrain_var = obs_variance;