ekf2: ensure minimum output buffer sizing

- buffer at least 2 samples for the IMU output predictor buffers
 - dropping below 2 becomes problematic for the minimum observation
interval calculation and the vertical output buffer trapezoidal
integration
This commit is contained in:
Daniel Agar 2022-10-31 12:25:39 -04:00
parent 9246d38667
commit 84d1435880
1 changed files with 1 additions and 1 deletions

View File

@ -503,7 +503,7 @@ bool EstimatorInterface::initialise_interface(uint64_t timestamp)
const float filter_update_period_ms = _params.filter_update_interval_us / 1000.f;
// calculate the IMU buffer length required to accomodate the maximum delay with some allowance for jitter
_imu_buffer_length = ceilf(max_time_delay_ms / filter_update_period_ms);
_imu_buffer_length = math::max(2, (int)ceilf(max_time_delay_ms / filter_update_period_ms));
// set the observation buffer length to handle the minimum time of arrival between observations in combination
// with the worst case delay from current time to ekf fusion time