From 66ad4f8e288e8db1de96642d222e42e4ecc175ef Mon Sep 17 00:00:00 2001 From: Andrea Bernasconi Date: Wed, 11 Nov 2026 10:35:50 +0100 Subject: [PATCH] fix(sensors): stop reporting a missing gyro on every retry with SENS_IMU_MODE 2 Each IMU's angular velocity instance always filters its own gyro, so once that gyro stops publishing it retried the selection every 10 ms and logged "unable to find or subscribe to selected sensor" each time, flooding the console and the log for the rest of the flight. It now waits quietly until the gyro publishes again. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Andrea Bernasconi --- .../vehicle_angular_velocity/VehicleAngularVelocity.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/sensors/vehicle_angular_velocity/VehicleAngularVelocity.cpp b/src/modules/sensors/vehicle_angular_velocity/VehicleAngularVelocity.cpp index e5cc1c25e6c..431e7df22f5 100644 --- a/src/modules/sensors/vehicle_angular_velocity/VehicleAngularVelocity.cpp +++ b/src/modules/sensors/vehicle_angular_velocity/VehicleAngularVelocity.cpp @@ -268,11 +268,14 @@ bool VehicleAngularVelocity::SensorSelectionUpdate(const hrt_abstime &time_now_u if (_imu_instance >= 0) { // always filter the same gyro, the selection only decides which instance publishes the median - device_id = uORB::SubscriptionData {ORB_ID(sensor_gyro), (uint8_t)_imu_instance} .get().device_id; + const sensor_gyro_s gyro = uORB::SubscriptionData {ORB_ID(sensor_gyro), (uint8_t)_imu_instance} .get(); - if (device_id == 0) { + // wait quietly while this gyro is missing instead of reporting it on every retry + if ((gyro.device_id == 0) || (time_now_us > gyro.timestamp + 1_s)) { return false; } + + device_id = gyro.device_id; } if ((_selected_sensor_device_id != device_id) || force) {