From aa64789792d551a5a4be0dda22606cac33449f98 Mon Sep 17 00:00:00 2001 From: wangwwno1 Date: Sun, 13 Mar 2022 00:29:23 +0800 Subject: [PATCH] sensors/vehicle_imu: Fix Integration Rate greater than Gyro Rate (#19318) --- src/modules/sensors/vehicle_imu/VehicleIMU.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/sensors/vehicle_imu/VehicleIMU.cpp b/src/modules/sensors/vehicle_imu/VehicleIMU.cpp index 26a557abfa..c2ad29781b 100644 --- a/src/modules/sensors/vehicle_imu/VehicleIMU.cpp +++ b/src/modules/sensors/vehicle_imu/VehicleIMU.cpp @@ -147,7 +147,7 @@ bool VehicleIMU::ParametersUpdate(bool force) // constrain IMU integration time 1-20 milliseconds (50-1000 Hz) int32_t imu_integration_rate_hz = constrain(_param_imu_integ_rate.get(), - (int32_t)50, math::max(_param_imu_gyro_ratemax.get(), (int32_t) 1000)); + (int32_t)50, math::min(_param_imu_gyro_ratemax.get(), (int32_t) 1000)); if (imu_integration_rate_hz != _param_imu_integ_rate.get()) { PX4_WARN("IMU_INTEG_RATE updated %" PRId32 " -> %" PRIu32, _param_imu_integ_rate.get(), imu_integration_rate_hz);