From cf5917d188f2d7f1754fef7306051014734ebc16 Mon Sep 17 00:00:00 2001 From: bresch Date: Fri, 6 Aug 2021 17:08:02 +0200 Subject: [PATCH] control_allocator: restructure param update recompute effectiveness on param change clear update at the end --- src/modules/control_allocator/ControlAllocator.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/modules/control_allocator/ControlAllocator.cpp b/src/modules/control_allocator/ControlAllocator.cpp index 1bb0ae312f..c8bbc95ec0 100644 --- a/src/modules/control_allocator/ControlAllocator.cpp +++ b/src/modules/control_allocator/ControlAllocator.cpp @@ -245,16 +245,18 @@ ControlAllocator::Run() // Check if parameters have changed if (_parameter_update_sub.updated()) { - // clear update - parameter_update_s param_update; - _parameter_update_sub.copy(¶m_update); + updateParams(); + parameters_updated(); if (_control_allocation) { _control_allocation->updateParameters(); } - updateParams(); - parameters_updated(); + update_effectiveness_matrix_if_needed(); + + // clear update + parameter_update_s param_update; + _parameter_update_sub.copy(¶m_update); } if (_control_allocation == nullptr || _actuator_effectiveness == nullptr) {