From a0e6e8a2404f4cc42ede8dd9d293617cbceb2a94 Mon Sep 17 00:00:00 2001 From: Jacob Dahl Date: Tue, 17 Mar 2026 21:55:34 -0800 Subject: [PATCH] refactor(fw_att_control): convert params.c to module.yaml Convert 1 parameter file(s) from legacy C format to YAML module configuration. --- src/modules/fw_att_control/CMakeLists.txt | 2 + .../fw_att_control/fw_att_control_params.c | 256 ------------------ .../fw_att_control/fw_att_control_params.yaml | 185 +++++++++++++ 3 files changed, 187 insertions(+), 256 deletions(-) delete mode 100644 src/modules/fw_att_control/fw_att_control_params.c create mode 100644 src/modules/fw_att_control/fw_att_control_params.yaml diff --git a/src/modules/fw_att_control/CMakeLists.txt b/src/modules/fw_att_control/CMakeLists.txt index f3f9b458c5..c18a5958b5 100644 --- a/src/modules/fw_att_control/CMakeLists.txt +++ b/src/modules/fw_att_control/CMakeLists.txt @@ -39,6 +39,8 @@ px4_add_module( FixedwingAttitudeControl.hpp fw_wheel_controller.cpp + MODULE_CONFIG + fw_att_control_params.yaml DEPENDS px4_work_queue ) diff --git a/src/modules/fw_att_control/fw_att_control_params.c b/src/modules/fw_att_control/fw_att_control_params.c deleted file mode 100644 index 554eac360c..0000000000 --- a/src/modules/fw_att_control/fw_att_control_params.c +++ /dev/null @@ -1,256 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2013-2023 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file fw_att_control_params.c - * - * Parameters defined by the fixed-wing attitude control task - * - * @author Lorenz Meier - * @author Thomas Gubler - */ - -/** - * Attitude Roll Time Constant - * - * This defines the latency between a roll step input and the achieved setpoint - * (inverse to a P gain). Smaller systems may require smaller values. - * - * @unit s - * @min 0.2 - * @max 1.0 - * @decimal 2 - * @increment 0.05 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_R_TC, 0.4f); - -/** - * Attitude pitch time constant - * - * This defines the latency between a pitch step input and the achieved setpoint - * (inverse to a P gain). Smaller systems may require smaller values. - * - * @unit s - * @min 0.2 - * @max 1.0 - * @decimal 2 - * @increment 0.05 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_P_TC, 0.4f); - -/** - * Maximum positive / up pitch rate setpoint - * - * @unit deg/s - * @min 0.0 - * @max 180 - * @decimal 1 - * @increment 0.5 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_P_RMAX_POS, 60.0f); - -/** - * Maximum negative / down pitch rate setpoint - * - * @unit deg/s - * @min 0.0 - * @max 180 - * @decimal 1 - * @increment 0.5 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_P_RMAX_NEG, 60.0f); - -/** - * Maximum roll rate setpoint - * - * @unit deg/s - * @min 0.0 - * @max 180 - * @decimal 1 - * @increment 0.5 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_R_RMAX, 70.0f); - -/** - * Maximum yaw rate setpoint - * - * @unit deg/s - * @min 0.0 - * @max 180 - * @decimal 1 - * @increment 0.5 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_Y_RMAX, 50.0f); - -/** - * Enable wheel steering controller - * - * Only enabled during automatic runway takeoff and landing. - * In all manual modes the wheel is directly controlled with yaw stick. - * - * @boolean - * @group FW Attitude Control - */ -PARAM_DEFINE_INT32(FW_W_EN, 0); - -/** - * Wheel steering rate proportional gain - * - * This defines how much the wheel steering input will be commanded depending on the - * current body angular rate error. - * - * @unit %/rad/s - * @min 0.0 - * @max 10 - * @decimal 3 - * @increment 0.005 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_WR_P, 0.5f); - -/** - * Wheel steering rate integrator gain - * - * This gain defines how much control response will result out of a steady - * state error. It trims any constant error. - * - * @unit %/rad - * @min 0.0 - * @max 10 - * @decimal 3 - * @increment 0.005 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_WR_I, 0.1f); - -/** - * Wheel steering rate integrator limit - * - * @min 0.0 - * @max 1.0 - * @decimal 2 - * @increment 0.05 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_WR_IMAX, 0.4f); - -/** - * Maximum wheel steering rate - * - * This limits the maximum wheel steering rate the controller will output (in degrees per - * second). - * - * @unit deg/s - * @min 0.0 - * @max 90.0 - * @decimal 1 - * @increment 0.5 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_W_RMAX, 30.0f); - -/** - * Wheel steering rate feed forward - * - * @unit %/rad/s - * @min 0.0 - * @max 10 - * @decimal 2 - * @increment 0.05 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_WR_FF, 0.2f); - -/** - * Pitch setpoint offset (pitch at level flight) - * - * An airframe specific offset of the pitch setpoint in degrees, the value is - * added to the pitch setpoint and should correspond to the pitch at - * typical cruise speed of the airframe. - * - * @unit deg - * @min -90.0 - * @max 90.0 - * @decimal 1 - * @increment 0.5 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_PSP_OFF, 0.0f); - -/** - * Maximum manually added yaw rate - * - * This is the maximally added yaw rate setpoint from the yaw stick in any attitude controlled flight mode. - * It is added to the yaw rate setpoint generated by the controller for turn coordination. - * - * @unit deg/s - * @min 0 - * @decimal 1 - * @increment 0.5 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_MAN_YR_MAX, 30.f); - -/** - * Maximum manual roll angle - * - * Applies to both directions in all manual modes with attitude stabilization - * - * @unit deg - * @min 0.0 - * @max 90.0 - * @decimal 1 - * @increment 0.5 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_MAN_R_MAX, 45.0f); - -/** - * Maximum manual pitch angle - * - * Applies to both directions in all manual modes with attitude stabilization but without altitude control - * - * @unit deg - * @min 0.0 - * @max 90.0 - * @decimal 1 - * @increment 0.5 - * @group FW Attitude Control - */ -PARAM_DEFINE_FLOAT(FW_MAN_P_MAX, 30.0f); diff --git a/src/modules/fw_att_control/fw_att_control_params.yaml b/src/modules/fw_att_control/fw_att_control_params.yaml new file mode 100644 index 0000000000..a258cbcbc8 --- /dev/null +++ b/src/modules/fw_att_control/fw_att_control_params.yaml @@ -0,0 +1,185 @@ +module_name: fw_att_control +parameters: +- group: FW Attitude Control + definitions: + FW_R_TC: + description: + short: Attitude Roll Time Constant + long: |- + This defines the latency between a roll step input and the achieved setpoint + (inverse to a P gain). Smaller systems may require smaller values. + type: float + default: 0.4 + unit: s + min: 0.2 + max: 1.0 + decimal: 2 + increment: 0.05 + FW_P_TC: + description: + short: Attitude pitch time constant + long: |- + This defines the latency between a pitch step input and the achieved setpoint + (inverse to a P gain). Smaller systems may require smaller values. + type: float + default: 0.4 + unit: s + min: 0.2 + max: 1.0 + decimal: 2 + increment: 0.05 + FW_P_RMAX_POS: + description: + short: Maximum positive / up pitch rate setpoint + type: float + default: 60.0 + unit: deg/s + min: 0.0 + max: 180 + decimal: 1 + increment: 0.5 + FW_P_RMAX_NEG: + description: + short: Maximum negative / down pitch rate setpoint + type: float + default: 60.0 + unit: deg/s + min: 0.0 + max: 180 + decimal: 1 + increment: 0.5 + FW_R_RMAX: + description: + short: Maximum roll rate setpoint + type: float + default: 70.0 + unit: deg/s + min: 0.0 + max: 180 + decimal: 1 + increment: 0.5 + FW_Y_RMAX: + description: + short: Maximum yaw rate setpoint + type: float + default: 50.0 + unit: deg/s + min: 0.0 + max: 180 + decimal: 1 + increment: 0.5 + FW_W_EN: + description: + short: Enable wheel steering controller + long: |- + Only enabled during automatic runway takeoff and landing. + In all manual modes the wheel is directly controlled with yaw stick. + type: boolean + default: 0 + FW_WR_P: + description: + short: Wheel steering rate proportional gain + long: |- + This defines how much the wheel steering input will be commanded depending on the + current body angular rate error. + type: float + default: 0.5 + unit: '%/rad/s' + min: 0.0 + max: 10 + decimal: 3 + increment: 0.005 + FW_WR_I: + description: + short: Wheel steering rate integrator gain + long: |- + This gain defines how much control response will result out of a steady + state error. It trims any constant error. + type: float + default: 0.1 + unit: '%/rad' + min: 0.0 + max: 10 + decimal: 3 + increment: 0.005 + FW_WR_IMAX: + description: + short: Wheel steering rate integrator limit + type: float + default: 0.4 + min: 0.0 + max: 1.0 + decimal: 2 + increment: 0.05 + FW_W_RMAX: + description: + short: Maximum wheel steering rate + long: |- + This limits the maximum wheel steering rate the controller will output (in degrees per + second). + type: float + default: 30.0 + unit: deg/s + min: 0.0 + max: 90.0 + decimal: 1 + increment: 0.5 + FW_WR_FF: + description: + short: Wheel steering rate feed forward + type: float + default: 0.2 + unit: '%/rad/s' + min: 0.0 + max: 10 + decimal: 2 + increment: 0.05 + FW_PSP_OFF: + description: + short: Pitch setpoint offset (pitch at level flight) + long: |- + An airframe specific offset of the pitch setpoint in degrees, the value is + added to the pitch setpoint and should correspond to the pitch at + typical cruise speed of the airframe. + type: float + default: 0.0 + unit: deg + min: -90.0 + max: 90.0 + decimal: 1 + increment: 0.5 + FW_MAN_YR_MAX: + description: + short: Maximum manually added yaw rate + long: |- + This is the maximally added yaw rate setpoint from the yaw stick in any attitude controlled flight mode. + It is added to the yaw rate setpoint generated by the controller for turn coordination. + type: float + default: 30.0 + unit: deg/s + min: 0 + decimal: 1 + increment: 0.5 + FW_MAN_R_MAX: + description: + short: Maximum manual roll angle + long: Applies to both directions in all manual modes with attitude stabilization + type: float + default: 45.0 + unit: deg + min: 0.0 + max: 90.0 + decimal: 1 + increment: 0.5 + FW_MAN_P_MAX: + description: + short: Maximum manual pitch angle + long: Applies to both directions in all manual modes with attitude stabilization + but without altitude control + type: float + default: 30.0 + unit: deg + min: 0.0 + max: 90.0 + decimal: 1 + increment: 0.5