sensors/vehicle_acceleration: sensor update loop limit iterations

This commit is contained in:
Daniel Agar 2024-03-04 12:59:46 -05:00
parent 87960c04d8
commit 2bf1eeb003
1 changed files with 4 additions and 1 deletions

View File

@ -231,9 +231,12 @@ void VehicleAcceleration::Run()
} }
// process all outstanding messages // process all outstanding messages
int sensor_sub_updates = 0;
sensor_accel_s sensor_data; sensor_accel_s sensor_data;
while (_sensor_sub.update(&sensor_data)) { while ((sensor_sub_updates < sensor_accel_s::ORB_QUEUE_LENGTH) && _sensor_sub.update(&sensor_data)) {
sensor_sub_updates++;
const Vector3f accel_raw{sensor_data.x, sensor_data.y, sensor_data.z}; const Vector3f accel_raw{sensor_data.x, sensor_data.y, sensor_data.z};
if (accel_raw.isAllFinite()) { if (accel_raw.isAllFinite()) {