From 38782029adba02e0dce8dbde3452f07f6074acec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 13 Aug 2020 08:20:35 +0200 Subject: [PATCH] fix control_allocator: set _last_run at the correct place --- src/modules/control_allocator/ControlAllocator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/control_allocator/ControlAllocator.cpp b/src/modules/control_allocator/ControlAllocator.cpp index 49fb75f372..192ab56fa1 100644 --- a/src/modules/control_allocator/ControlAllocator.cpp +++ b/src/modules/control_allocator/ControlAllocator.cpp @@ -295,7 +295,6 @@ ControlAllocator::Run() // Guard against too small (< 0.2ms) and too large (> 20ms) dt's. const hrt_abstime now = hrt_absolute_time(); const float dt = math::constrain(((now - _last_run) / 1e6f), 0.0002f, 0.02f); - _last_run = now; bool do_update = false; vehicle_torque_setpoint_s vehicle_torque_setpoint; @@ -322,6 +321,7 @@ ControlAllocator::Run() } if (do_update) { + _last_run = now; // Update effectiveness matrix if needed if (_actuator_effectiveness->update()) {