From 3606f86518ee594f60a798e8ae22650759f6a332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 13 Aug 2020 08:20:57 +0200 Subject: [PATCH] control_allocator: ensure unused outputs are initialized to min Mostly important in cases where the ouputs would change (e.g. param change) --- .../control_allocator/ControlAllocation/ControlAllocation.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/control_allocator/ControlAllocation/ControlAllocation.cpp b/src/modules/control_allocator/ControlAllocation/ControlAllocation.cpp index b442d183f0..eb2653db8f 100644 --- a/src/modules/control_allocator/ControlAllocation/ControlAllocation.cpp +++ b/src/modules/control_allocator/ControlAllocation/ControlAllocation.cpp @@ -52,6 +52,10 @@ ControlAllocation::setEffectivenessMatrix( _control_trim = _effectiveness * _actuator_trim; _num_actuators = num_actuators; + // make sure unused actuators are initialized to min + for (int i = num_actuators; i < NUM_ACTUATORS; ++i) { + _actuator_sp(i) = _actuator_min(i); + } } void