control_allocator: restructure param update

recompute effectiveness on param change
clear update at the end
This commit is contained in:
bresch
2021-08-06 17:08:02 +02:00
committed by Daniel Agar
parent 9d974062d0
commit cf5917d188
@@ -245,16 +245,18 @@ ControlAllocator::Run()
// Check if parameters have changed // Check if parameters have changed
if (_parameter_update_sub.updated()) { if (_parameter_update_sub.updated()) {
// clear update updateParams();
parameter_update_s param_update; parameters_updated();
_parameter_update_sub.copy(&param_update);
if (_control_allocation) { if (_control_allocation) {
_control_allocation->updateParameters(); _control_allocation->updateParameters();
} }
updateParams(); update_effectiveness_matrix_if_needed();
parameters_updated();
// clear update
parameter_update_s param_update;
_parameter_update_sub.copy(&param_update);
} }
if (_control_allocation == nullptr || _actuator_effectiveness == nullptr) { if (_control_allocation == nullptr || _actuator_effectiveness == nullptr) {