From 20d8de2dca440e749c3d4bf707510e746237e20f Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Sun, 14 Mar 2021 21:36:39 -0400 Subject: [PATCH] gyro_fft: reduce run frequency (still consuming all queued data) --- msg/sensor_gyro_fifo.msg | 2 +- src/modules/gyro_fft/GyroFFT.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/msg/sensor_gyro_fifo.msg b/msg/sensor_gyro_fifo.msg index cba63efe8d..957336e5e2 100644 --- a/msg/sensor_gyro_fifo.msg +++ b/msg/sensor_gyro_fifo.msg @@ -14,4 +14,4 @@ int16[32] z # angular velocity in the FRD board frame Z-axis in ra uint8 rotation # Direction the sensor faces (see Rotation enum) -uint8 ORB_QUEUE_LENGTH = 2 +uint8 ORB_QUEUE_LENGTH = 4 diff --git a/src/modules/gyro_fft/GyroFFT.cpp b/src/modules/gyro_fft/GyroFFT.cpp index 386b50fef6..31d5b2f368 100644 --- a/src/modules/gyro_fft/GyroFFT.cpp +++ b/src/modules/gyro_fft/GyroFFT.cpp @@ -125,10 +125,11 @@ bool GyroFFT::SensorSelectionUpdate(bool force) if (sensor_gyro_fifo_sub.get().device_id == sensor_selection.gyro_device_id) { if (_sensor_gyro_fifo_sub.ChangeInstance(i) && _sensor_gyro_fifo_sub.registerCallback()) { + _sensor_gyro_fifo_sub.set_required_updates(sensor_gyro_fifo_s::ORB_QUEUE_LENGTH - 1); + // find corresponding vehicle_imu_status instance for (uint8_t imu_status = 0; imu_status < MAX_SENSOR_COUNT; imu_status++) { uORB::Subscription imu_status_sub{ORB_ID(vehicle_imu_status), imu_status}; - vehicle_imu_status_s vehicle_imu_status; if (imu_status_sub.copy(&vehicle_imu_status)) {