From 6bcf03bf7116071445399a146fe676169189ef52 Mon Sep 17 00:00:00 2001 From: bresch <[brescianimathieu@gmail.com](mailto:brescianimathieu@gmail.com)> Date: Thu, 16 Nov 2023 17:31:33 +0100 Subject: [PATCH] atune: initialize filter if not already initialized --- .../fw_autotune_attitude_control.cpp | 2 +- .../mc_autotune_attitude_control.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/fw_autotune_attitude_control/fw_autotune_attitude_control.cpp b/src/modules/fw_autotune_attitude_control/fw_autotune_attitude_control.cpp index ec274f28dac2..641a90465cba 100644 --- a/src/modules/fw_autotune_attitude_control/fw_autotune_attitude_control.cpp +++ b/src/modules/fw_autotune_attitude_control/fw_autotune_attitude_control.cpp @@ -225,7 +225,7 @@ void FwAutotuneAttitudeControl::checkFilters() reset_filters = true; } - if (reset_filters) { + if (reset_filters || !_are_filters_initialized) { _are_filters_initialized = true; _filter_sample_rate = update_rate_hz; _sys_id.setLpfCutoffFrequency(_filter_sample_rate, _param_imu_gyro_cutoff.get()); diff --git a/src/modules/mc_autotune_attitude_control/mc_autotune_attitude_control.cpp b/src/modules/mc_autotune_attitude_control/mc_autotune_attitude_control.cpp index 749186ee8d04..c99ccad653ab 100644 --- a/src/modules/mc_autotune_attitude_control/mc_autotune_attitude_control.cpp +++ b/src/modules/mc_autotune_attitude_control/mc_autotune_attitude_control.cpp @@ -236,7 +236,7 @@ void McAutotuneAttitudeControl::checkFilters() reset_filters = true; } - if (reset_filters && !_are_filters_initialized) { + if (reset_filters || !_are_filters_initialized) { _filter_dt = _sample_interval_avg; const float filter_rate_hz = 1.f / _filter_dt;