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 <andrea.bernasconi@auterion.com>
This commit is contained in:
Andrea Bernasconi authored and Matthias Grob committed 2026-11-18 16:22:25 +01:00
1 parent 59ece7d571
commit 66ad4f8e28
1 file changed
+5 -2
@@ -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<sensor_gyro_s> {ORB_ID(sensor_gyro), (uint8_t)_imu_instance} .get().device_id;
const sensor_gyro_s gyro = uORB::SubscriptionData<sensor_gyro_s> {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) {