From 2b53193b5df19c24df24721a14a906df08822759 Mon Sep 17 00:00:00 2001 From: ttechnick Date: Mon, 17 Nov 2025 13:51:17 +0100 Subject: [PATCH] add migration formula --- docs/en/config/actuators.md | 3 +++ .../ActuatorEffectivenessControlSurfaces.cpp | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/en/config/actuators.md b/docs/en/config/actuators.md index 222860bc7e..e4346ce059 100644 --- a/docs/en/config/actuators.md +++ b/docs/en/config/actuators.md @@ -654,6 +654,9 @@ For each of the tilt servos: - Standard VTOL : Motors defined as multicopter motors will be turned off - Tiltrotors : Motors that have no associated tilt servo will turn off - Tailsitters do not turn off any motors in fixed-wing flight +- The following formula can be used to migrate from surface trim to PWM trim: + + `PWM_MAIN_TRIMx = ((PWM_MAX - PWM_MIN) / 2) * CA_SV_CSx_TRIM + TRIM_MIN + ((PWM_MAX - PWM_MIN) / 2)` ### Reversing Motors diff --git a/src/modules/control_allocator/VehicleActuatorEffectiveness/ActuatorEffectivenessControlSurfaces.cpp b/src/modules/control_allocator/VehicleActuatorEffectiveness/ActuatorEffectivenessControlSurfaces.cpp index 8a8359667b..f552f7b132 100644 --- a/src/modules/control_allocator/VehicleActuatorEffectiveness/ActuatorEffectivenessControlSurfaces.cpp +++ b/src/modules/control_allocator/VehicleActuatorEffectiveness/ActuatorEffectivenessControlSurfaces.cpp @@ -80,7 +80,8 @@ void ActuatorEffectivenessControlSurfaces::updateParams() snprintf(param_name, sizeof(param_name), "%s_TRIM%d", prefix, channel); param_t param = param_find(param_name); - if (param != PARAM_INVALID) { + if (param != PARAM_INVALID) + { int32_t value; return (param_get(param, &value) == PX4_OK && value != 1500); }