From 2751f1734cec1a31f175d5fc561690570916512a Mon Sep 17 00:00:00 2001 From: Jacob Dahl Date: Tue, 17 Mar 2026 21:55:35 -0800 Subject: [PATCH] refactor(vtol_att_control): convert params.c to module.yaml Convert 3 parameter file(s) from legacy C format to YAML module configuration. --- src/modules/vtol_att_control/CMakeLists.txt | 4 + .../vtol_att_control/standard_params.c | 107 ----- .../vtol_att_control/standard_params.yaml | 62 +++ .../vtol_att_control/tiltrotor_params.c | 100 ----- .../vtol_att_control/tiltrotor_params.yaml | 53 +++ .../vtol_att_control_params.c | 395 ------------------ .../vtol_att_control_params.yaml | 302 +++++++++++++ 7 files changed, 421 insertions(+), 602 deletions(-) delete mode 100644 src/modules/vtol_att_control/standard_params.c create mode 100644 src/modules/vtol_att_control/standard_params.yaml delete mode 100644 src/modules/vtol_att_control/tiltrotor_params.c create mode 100644 src/modules/vtol_att_control/tiltrotor_params.yaml delete mode 100644 src/modules/vtol_att_control/vtol_att_control_params.c create mode 100644 src/modules/vtol_att_control/vtol_att_control_params.yaml diff --git a/src/modules/vtol_att_control/CMakeLists.txt b/src/modules/vtol_att_control/CMakeLists.txt index 780217ccc6..9cd91f6275 100644 --- a/src/modules/vtol_att_control/CMakeLists.txt +++ b/src/modules/vtol_att_control/CMakeLists.txt @@ -39,4 +39,8 @@ px4_add_module( vtol_type.cpp tailsitter.cpp standard.cpp + MODULE_CONFIG + standard_params.yaml + tiltrotor_params.yaml + vtol_att_control_params.yaml ) diff --git a/src/modules/vtol_att_control/standard_params.c b/src/modules/vtol_att_control/standard_params.c deleted file mode 100644 index 99a3fdef09..0000000000 --- a/src/modules/vtol_att_control/standard_params.c +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2015 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 standard_params.c - * Parameters for the standard VTOL controller. - * - * @author Simon Wilks - * @author Roman Bapst - */ - - -/** - * Use fixed-wing actuation in hover to accelerate forward - * - * Prevents downforce from pitching the body down when facing wind. - * Uses puller/pusher (standard VTOL), or forward-tilt (tiltrotor VTOL) to accelerate forward instead. - * Only active if demanded pitch is below VT_PITCH_MIN. - * Use VT_FWD_THRUST_SC to tune it. - * Descend mode is treated as Landing too. - * - * Only active (if enabled) in height-rate controlled modes. - * - * @value 0 Disabled - * @value 1 Enabled (except LANDING) - * @value 2 Enabled if above MPC_LAND_ALT1 - * @value 3 Enabled if above MPC_LAND_ALT2 - * @value 4 Enabled constantly - * @value 5 Enabled if above MPC_LAND_ALT1 (except LANDING) - * @value 6 Enabled if above MPC_LAND_ALT2 (except LANDING) - * - * @group VTOL Attitude Control - */ -PARAM_DEFINE_INT32(VT_FWD_THRUST_EN, 0); - -/** - * Fixed-wing actuation thrust scale in hover - * - * Scale applied to the demanded pitch (below VT_PITCH_MIN) to get the fixed-wing forward actuation in hover mode. - * Enabled via VT_FWD_THRUST_EN. - * - * @min 0.0 - * @max 5.0 - * @increment 0.01 - * @decimal 2 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_FWD_THRUST_SC, 0.7f); - -/** - * Back transition MC motor ramp up time - * - * This sets the duration during which the MC motors ramp up to the commanded thrust during the back transition stage. - * - * @unit s - * @min 0.0 - * @max 20.0 - * @increment 0.1 - * @decimal 1 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_B_TRANS_RAMP, 3.0f); - -/** - * Pusher throttle ramp up slew rate - * - * Defines the slew rate of the puller/pusher throttle during transitions. - * Zero will deactivate the slew rate limiting and thus produce an instant throttle - * rise to the transition throttle VT_F_TRANS_THR. - * - * @unit 1/s - * @min 0 - * @increment 0.01 - * @decimal 2 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_PSHER_SLEW, 0.33f); diff --git a/src/modules/vtol_att_control/standard_params.yaml b/src/modules/vtol_att_control/standard_params.yaml new file mode 100644 index 0000000000..ae9e32f44d --- /dev/null +++ b/src/modules/vtol_att_control/standard_params.yaml @@ -0,0 +1,62 @@ +module_name: vtol_att_control +parameters: +- group: VTOL Attitude Control + definitions: + VT_FWD_THRUST_EN: + description: + short: Use fixed-wing actuation in hover to accelerate forward + long: |- + Prevents downforce from pitching the body down when facing wind. + Uses puller/pusher (standard VTOL), or forward-tilt (tiltrotor VTOL) to accelerate forward instead. + Only active if demanded pitch is below VT_PITCH_MIN. + Use VT_FWD_THRUST_SC to tune it. + Descend mode is treated as Landing too. + + Only active (if enabled) in height-rate controlled modes. + type: enum + values: + 0: Disabled + 1: Enabled (except LANDING) + 2: Enabled if above MPC_LAND_ALT1 + 3: Enabled if above MPC_LAND_ALT2 + 4: Enabled constantly + 5: Enabled if above MPC_LAND_ALT1 (except LANDING) + 6: Enabled if above MPC_LAND_ALT2 (except LANDING) + default: 0 + VT_FWD_THRUST_SC: + description: + short: Fixed-wing actuation thrust scale in hover + long: |- + Scale applied to the demanded pitch (below VT_PITCH_MIN) to get the fixed-wing forward actuation in hover mode. + Enabled via VT_FWD_THRUST_EN. + type: float + default: 0.7 + min: 0.0 + max: 5.0 + increment: 0.01 + decimal: 2 + VT_B_TRANS_RAMP: + description: + short: Back transition MC motor ramp up time + long: This sets the duration during which the MC motors ramp up to the commanded + thrust during the back transition stage. + type: float + default: 3.0 + unit: s + min: 0.0 + max: 20.0 + increment: 0.1 + decimal: 1 + VT_PSHER_SLEW: + description: + short: Pusher throttle ramp up slew rate + long: |- + Defines the slew rate of the puller/pusher throttle during transitions. + Zero will deactivate the slew rate limiting and thus produce an instant throttle + rise to the transition throttle VT_F_TRANS_THR. + type: float + default: 0.33 + unit: 1/s + min: 0 + increment: 0.01 + decimal: 2 diff --git a/src/modules/vtol_att_control/tiltrotor_params.c b/src/modules/vtol_att_control/tiltrotor_params.c deleted file mode 100644 index 92fa558454..0000000000 --- a/src/modules/vtol_att_control/tiltrotor_params.c +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2015 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 tiltrotor_params.c - * Parameters for vtol attitude controller. - * - * @author Roman Bapst - */ - -/** - * Normalized tilt in Hover - * - * @min 0.0 - * @max 1.0 - * @increment 0.01 - * @decimal 3 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_TILT_MC, 0.0f); - -/** - * Normalized tilt in transition to FW - * - * @min 0.0 - * @max 1.0 - * @increment 0.01 - * @decimal 3 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_TILT_TRANS, 0.4f); - -/** - * Normalized tilt in FW - * - * @min 0.0 - * @max 1.0 - * @increment 0.01 - * @decimal 3 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_TILT_FW, 1.0f); - -/** - * Duration of front transition phase 2 - * - * Time in seconds it takes to tilt form VT_TILT_TRANS to VT_TILT_FW. - * - * @unit s - * @min 0.1 - * @max 5.0 - * @increment 0.01 - * @decimal 3 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_TRANS_P2_DUR, 0.5f); - -/** - * Duration motor tilt up in backtransition - * - * Time in seconds it takes to tilt form VT_TILT_FW to VT_TILT_MC. - * - * @unit s - * @min 0.1 - * @max 10 - * @increment 0.1 - * @decimal 1 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_BT_TILT_DUR, 1.f); diff --git a/src/modules/vtol_att_control/tiltrotor_params.yaml b/src/modules/vtol_att_control/tiltrotor_params.yaml new file mode 100644 index 0000000000..d7f6d06fe5 --- /dev/null +++ b/src/modules/vtol_att_control/tiltrotor_params.yaml @@ -0,0 +1,53 @@ +module_name: vtol_att_control +parameters: +- group: VTOL Attitude Control + definitions: + VT_TILT_MC: + description: + short: Normalized tilt in Hover + type: float + default: 0.0 + min: 0.0 + max: 1.0 + increment: 0.01 + decimal: 3 + VT_TILT_TRANS: + description: + short: Normalized tilt in transition to FW + type: float + default: 0.4 + min: 0.0 + max: 1.0 + increment: 0.01 + decimal: 3 + VT_TILT_FW: + description: + short: Normalized tilt in FW + type: float + default: 1.0 + min: 0.0 + max: 1.0 + increment: 0.01 + decimal: 3 + VT_TRANS_P2_DUR: + description: + short: Duration of front transition phase 2 + long: Time in seconds it takes to tilt form VT_TILT_TRANS to VT_TILT_FW. + type: float + default: 0.5 + unit: s + min: 0.1 + max: 5.0 + increment: 0.01 + decimal: 3 + VT_BT_TILT_DUR: + description: + short: Duration motor tilt up in backtransition + long: Time in seconds it takes to tilt form VT_TILT_FW to VT_TILT_MC. + type: float + default: 1.0 + unit: s + min: 0.1 + max: 10 + increment: 0.1 + decimal: 1 diff --git a/src/modules/vtol_att_control/vtol_att_control_params.c b/src/modules/vtol_att_control/vtol_att_control_params.c deleted file mode 100644 index 96727f0c53..0000000000 --- a/src/modules/vtol_att_control/vtol_att_control_params.c +++ /dev/null @@ -1,395 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2014-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 vtol_att_control_params.c - * Parameters for vtol attitude controller. - * - * @author Roman Bapst - * @author Sander Smeets - */ - -/** - * VTOL Type (Tailsitter=0, Tiltrotor=1, Standard=2) - * - * @value 0 Tailsitter - * @value 1 Tiltrotor - * @value 2 Standard - * @min 0 - * @max 2 - * @reboot_required true - * @group VTOL Attitude Control - */ -PARAM_DEFINE_INT32(VT_TYPE, 0); - -/** - * Lock control surfaces in hover - * - * If set to 1 the control surfaces are locked at the disarmed value in multicopter mode. - * - * @boolean - * @group VTOL Attitude Control - */ -PARAM_DEFINE_INT32(VT_ELEV_MC_LOCK, 1); - -/** - * Duration of a front transition - * - * Time in seconds used for a transition - * - * @unit s - * @min 0.1 - * @max 20.00 - * @increment 1 - * @decimal 2 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_F_TRANS_DUR, 5.0f); - -/** - * Maximum duration of a back transition - * - * Transition is also declared over if the groundspeed drops below MPC_XY_CRUISE. - * - * @unit s - * @min 0.1 - * @max 20.00 - * @increment 1 - * @decimal 2 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_B_TRANS_DUR, 10.0f); - -/** - * Target throttle value for the transition to fixed-wing flight. - * - * @min 0.0 - * @max 1.0 - * @increment 0.01 - * @decimal 3 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_F_TRANS_THR, 1.0f); - -/** - * Approximate deceleration during back transition - * - * Used to calculate back transition distance in an auto mode. - * For standard vtol and tiltrotors a controller is used to track this value during the transition. - * - * @unit m/s^2 - * @min 0.5 - * @max 10 - * @increment 0.1 - * @decimal 2 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_B_DEC_MSS, 2.0f); - -/** - * Transition blending airspeed - * - * Airspeed at which we can start blending both fw and mc controls. Set to 0 to disable. - * - * @unit m/s - * @min 0.00 - * @max 30.00 - * @increment 1 - * @decimal 2 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_ARSP_BLEND, 8.0f); - -/** - * Transition airspeed - * - * Airspeed at which we can switch to fw mode - * - * @unit m/s - * @min 0.00 - * @max 30.00 - * @increment 1 - * @decimal 2 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_ARSP_TRANS, 10.0f); - -/** - * Front transition timeout - * - * Time in seconds after which transition will be cancelled. - * - * @unit s - * @min 0.1 - * @max 30.00 - * @increment 1 - * @decimal 2 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_TRANS_TIMEOUT, 15.0f); - -/** - * Front transition minimum time - * - * Minimum time in seconds for front transition. - * - * @unit s - * @min 0.0 - * @max 20.0 - * @increment 0.1 - * @decimal 1 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_TRANS_MIN_TM, 2.0f); - -/** - * Quad-chute altitude - * - * Minimum altitude for fixed-wing flight. When the vehicle is in fixed-wing mode - * and the altitude drops below this altitude (relative altitude above local origin), - * it will instantly switch back to MC mode and execute behavior defined in COM_QC_ACT. - * - * @unit m - * @min 0.0 - * @max 200.0 - * @increment 1 - * @decimal 1 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_FW_MIN_ALT, 0.0f); - -/** - * Quad-chute uncommanded descent threshold - * - * Altitude error threshold for quad-chute triggering during fixed-wing flight. - * The check is only active if altitude is controlled and the vehicle is below the current altitude reference. - * The altitude error is relative to the highest altitude the vehicle has achieved since it has flown below the current - * altitude reference. - * - * Set to 0 do disable. - * - * @unit m - * @min 0.0 - * @max 200.0 - * @increment 1 - * @decimal 1 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_QC_ALT_LOSS, 0.0f); - -/** - * Quad-chute transition altitude loss threshold - * - * Altitude loss threshold for quad-chute triggering during VTOL transition to fixed-wing flight - * in altitude-controlled flight modes. - * Active until 5s after completing transition to fixed-wing. - * If the current altitude is more than this value below the altitude at the beginning of the - * transition, it will instantly switch back to MC mode and execute behavior defined in COM_QC_ACT. - * - * Set to 0 do disable this threshold. - * - * @unit m - * @min 0 - * @max 50 - * @increment 1 - * @decimal 1 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_QC_T_ALT_LOSS, 20.0f); - -/** - * Quad-chute max pitch threshold - * - * Absolute pitch threshold for quad-chute triggering in FW mode. - * Above this the vehicle will transition back to MC mode and execute behavior defined in COM_QC_ACT. - * Set to 0 do disable this threshold. - * - * @unit deg - * @min 0 - * @max 180 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_INT32(VT_FW_QC_P, 0); - -/** - * Quad-chute max roll threshold - * - * Absolute roll threshold for quad-chute triggering in FW mode. - * Above this the vehicle will transition back to MC mode and execute behavior defined in COM_QC_ACT. - * Set to 0 do disable this threshold. - * - * @unit deg - * @min 0 - * @max 180 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_INT32(VT_FW_QC_R, 0); - -/** - * Quad-chute maximum height - * - * Maximum height above the ground (if available, otherwise above - * Home if available, otherwise above the local origin) where triggering a quad-chute is possible. - * At high altitudes there is a big risk to deplete the battery and therefore crash if quad-chuting there. - * - * @unit m - * @min 0 - * @increment 1 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_INT32(VT_FW_QC_HMAX, 0); - -/** - * Airspeed-less front transition time (open loop) - * - * The duration of the front transition when there is no airspeed feedback available. - * When airspeed is used, transition timeout is declared if airspeed does not - * reach VT_ARSP_BLEND after this time. - * - * @unit s - * @min 1.0 - * @max 30.0 - * @increment 0.5 - * @decimal 1 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_F_TR_OL_TM, 6.0f); - -/** - * Differential thrust in forwards flight. - * - * Enable differential thrust seperately for roll, pitch, yaw in forward (fixed-wing) mode. - * The effectiveness of differential thrust around the corresponding axis can be - * tuned by setting VT_FW_DIFTHR_S_R / VT_FW_DIFTHR_S_P / VT_FW_DIFTHR_S_Y. - * - * @min 0 - * @max 7 - * @bit 0 Yaw - * @bit 1 Roll - * @bit 2 Pitch - * @group VTOL Attitude Control - */ -PARAM_DEFINE_INT32(VT_FW_DIFTHR_EN, 0); - -/** - * Roll differential thrust factor in forward flight - * - * Differential thrust in forward flight is enabled via VT_FW_DIFTHR_EN. - * - * @min 0.0 - * @max 2.0 - * @decimal 2 - * @increment 0.1 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_FW_DIFTHR_S_R, 1.f); - -/** - * Pitch differential thrust factor in forward flight - * - * Differential thrust in forward flight is enabled via VT_FW_DIFTHR_EN. - * - * @min 0.0 - * @max 2.0 - * @decimal 2 - * @increment 0.1 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_FW_DIFTHR_S_P, 1.f); - -/** - * Yaw differential thrust factor in forward flight - * - * Differential thrust in forward flight is enabled via VT_FW_DIFTHR_EN. - * - * @min 0.0 - * @max 2.0 - * @decimal 2 - * @increment 0.1 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_FW_DIFTHR_S_Y, 0.1f); - -/** - * Backtransition deceleration setpoint to tilt I gain. - * - * @unit rad s/m - * @min 0 - * @max 0.3 - * @decimal 2 - * @increment 0.05 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_B_DEC_I, 0.1f); - -/** - * Minimum pitch angle during hover. - * - * Any pitch setpoint below this value is translated to a forward force by the fixed-wing forward actuation if - * VT_FWD_TRHUST_EN is set. - * - * @unit deg - * @min -10.0 - * @max 45.0 - * @increment 0.1 - * @decimal 1 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_PITCH_MIN, 0.0f); - -/** - * Minimum pitch angle during hover landing. - * - * Overrides VT_PITCH_MIN when the vehicle is in LAND mode (hovering). - * During landing it can be beneficial to reduce the pitch angle to reduce the generated lift in head wind. - * - * @unit deg - * @min -10.0 - * @max 45.0 - * @increment 0.1 - * @decimal 1 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_LND_PITCH_MIN, 0.0f); - -/** - * Spoiler setting while landing (hover) - * - * @unit norm - * @min -1 - * @max 1 - * @decimal 1 - * @increment 0.1 - * @group VTOL Attitude Control - */ -PARAM_DEFINE_FLOAT(VT_SPOILER_MC_LD, 0.f); diff --git a/src/modules/vtol_att_control/vtol_att_control_params.yaml b/src/modules/vtol_att_control/vtol_att_control_params.yaml new file mode 100644 index 0000000000..e8f5a65393 --- /dev/null +++ b/src/modules/vtol_att_control/vtol_att_control_params.yaml @@ -0,0 +1,302 @@ +module_name: vtol_att_control +parameters: +- group: VTOL Attitude Control + definitions: + VT_TYPE: + description: + short: VTOL Type (Tailsitter=0, Tiltrotor=1, Standard=2) + type: enum + values: + 0: Tailsitter + 1: Tiltrotor + 2: Standard + default: 0 + min: 0 + max: 2 + reboot_required: true + VT_ELEV_MC_LOCK: + description: + short: Lock control surfaces in hover + long: If set to 1 the control surfaces are locked at the disarmed value in + multicopter mode. + type: boolean + default: 1 + VT_F_TRANS_DUR: + description: + short: Duration of a front transition + long: Time in seconds used for a transition + type: float + default: 5.0 + unit: s + min: 0.1 + max: 20.0 + increment: 1 + decimal: 2 + VT_B_TRANS_DUR: + description: + short: Maximum duration of a back transition + long: Transition is also declared over if the groundspeed drops below MPC_XY_CRUISE. + type: float + default: 10.0 + unit: s + min: 0.1 + max: 20.0 + increment: 1 + decimal: 2 + VT_F_TRANS_THR: + description: + short: Target throttle value for the transition to fixed-wing flight + type: float + default: 1.0 + min: 0.0 + max: 1.0 + increment: 0.01 + decimal: 3 + VT_B_DEC_MSS: + description: + short: Approximate deceleration during back transition + long: |- + Used to calculate back transition distance in an auto mode. + For standard vtol and tiltrotors a controller is used to track this value during the transition. + type: float + default: 2.0 + unit: m/s^2 + min: 0.5 + max: 10 + increment: 0.1 + decimal: 2 + VT_ARSP_BLEND: + description: + short: Transition blending airspeed + long: Airspeed at which we can start blending both fw and mc controls. Set + to 0 to disable. + type: float + default: 8.0 + unit: m/s + min: 0.0 + max: 30.0 + increment: 1 + decimal: 2 + VT_ARSP_TRANS: + description: + short: Transition airspeed + long: Airspeed at which we can switch to fw mode + type: float + default: 10.0 + unit: m/s + min: 0.0 + max: 30.0 + increment: 1 + decimal: 2 + VT_TRANS_TIMEOUT: + description: + short: Front transition timeout + long: Time in seconds after which transition will be cancelled. + type: float + default: 15.0 + unit: s + min: 0.1 + max: 30.0 + increment: 1 + decimal: 2 + VT_TRANS_MIN_TM: + description: + short: Front transition minimum time + long: Minimum time in seconds for front transition. + type: float + default: 2.0 + unit: s + min: 0.0 + max: 20.0 + increment: 0.1 + decimal: 1 + VT_FW_MIN_ALT: + description: + short: Quad-chute altitude + long: |- + Minimum altitude for fixed-wing flight. When the vehicle is in fixed-wing mode + and the altitude drops below this altitude (relative altitude above local origin), + it will instantly switch back to MC mode and execute behavior defined in COM_QC_ACT. + type: float + default: 0.0 + unit: m + min: 0.0 + max: 200.0 + increment: 1 + decimal: 1 + VT_QC_ALT_LOSS: + description: + short: Quad-chute uncommanded descent threshold + long: |- + Altitude error threshold for quad-chute triggering during fixed-wing flight. + The check is only active if altitude is controlled and the vehicle is below the current altitude reference. + The altitude error is relative to the highest altitude the vehicle has achieved since it has flown below the current + altitude reference. + + Set to 0 do disable. + type: float + default: 0.0 + unit: m + min: 0.0 + max: 200.0 + increment: 1 + decimal: 1 + VT_QC_T_ALT_LOSS: + description: + short: Quad-chute transition altitude loss threshold + long: |- + Altitude loss threshold for quad-chute triggering during VTOL transition to fixed-wing flight + in altitude-controlled flight modes. + Active until 5s after completing transition to fixed-wing. + If the current altitude is more than this value below the altitude at the beginning of the + transition, it will instantly switch back to MC mode and execute behavior defined in COM_QC_ACT. + + Set to 0 do disable this threshold. + type: float + default: 20.0 + unit: m + min: 0 + max: 50 + increment: 1 + decimal: 1 + VT_FW_QC_P: + description: + short: Quad-chute max pitch threshold + long: |- + Absolute pitch threshold for quad-chute triggering in FW mode. + Above this the vehicle will transition back to MC mode and execute behavior defined in COM_QC_ACT. + Set to 0 do disable this threshold. + type: int32 + default: 0 + unit: deg + min: 0 + max: 180 + VT_FW_QC_R: + description: + short: Quad-chute max roll threshold + long: |- + Absolute roll threshold for quad-chute triggering in FW mode. + Above this the vehicle will transition back to MC mode and execute behavior defined in COM_QC_ACT. + Set to 0 do disable this threshold. + type: int32 + default: 0 + unit: deg + min: 0 + max: 180 + VT_FW_QC_HMAX: + description: + short: Quad-chute maximum height + long: |- + Maximum height above the ground (if available, otherwise above + Home if available, otherwise above the local origin) where triggering a quad-chute is possible. + At high altitudes there is a big risk to deplete the battery and therefore crash if quad-chuting there. + type: int32 + default: 0 + unit: m + min: 0 + increment: 1 + VT_F_TR_OL_TM: + description: + short: Airspeed-less front transition time (open loop) + long: |- + The duration of the front transition when there is no airspeed feedback available. + When airspeed is used, transition timeout is declared if airspeed does not + reach VT_ARSP_BLEND after this time. + type: float + default: 6.0 + unit: s + min: 1.0 + max: 30.0 + increment: 0.5 + decimal: 1 + VT_FW_DIFTHR_EN: + description: + short: Differential thrust in forwards flight + long: |- + Enable differential thrust seperately for roll, pitch, yaw in forward (fixed-wing) mode. + The effectiveness of differential thrust around the corresponding axis can be + tuned by setting VT_FW_DIFTHR_S_R / VT_FW_DIFTHR_S_P / VT_FW_DIFTHR_S_Y. + type: bitmask + bit: + 0: Yaw + 1: Roll + 2: Pitch + default: 0 + min: 0 + max: 7 + VT_FW_DIFTHR_S_R: + description: + short: Roll differential thrust factor in forward flight + long: Differential thrust in forward flight is enabled via VT_FW_DIFTHR_EN. + type: float + default: 1.0 + min: 0.0 + max: 2.0 + decimal: 2 + increment: 0.1 + VT_FW_DIFTHR_S_P: + description: + short: Pitch differential thrust factor in forward flight + long: Differential thrust in forward flight is enabled via VT_FW_DIFTHR_EN. + type: float + default: 1.0 + min: 0.0 + max: 2.0 + decimal: 2 + increment: 0.1 + VT_FW_DIFTHR_S_Y: + description: + short: Yaw differential thrust factor in forward flight + long: Differential thrust in forward flight is enabled via VT_FW_DIFTHR_EN. + type: float + default: 0.1 + min: 0.0 + max: 2.0 + decimal: 2 + increment: 0.1 + VT_B_DEC_I: + description: + short: Backtransition deceleration setpoint to tilt I gain + type: float + default: 0.1 + unit: rad s/m + min: 0 + max: 0.3 + decimal: 2 + increment: 0.05 + VT_PITCH_MIN: + description: + short: Minimum pitch angle during hover + long: |- + Any pitch setpoint below this value is translated to a forward force by the fixed-wing forward actuation if + VT_FWD_TRHUST_EN is set. + type: float + default: 0.0 + unit: deg + min: -10.0 + max: 45.0 + increment: 0.1 + decimal: 1 + VT_LND_PITCH_MIN: + description: + short: Minimum pitch angle during hover landing + long: |- + Overrides VT_PITCH_MIN when the vehicle is in LAND mode (hovering). + During landing it can be beneficial to reduce the pitch angle to reduce the generated lift in head wind. + type: float + default: 0.0 + unit: deg + min: -10.0 + max: 45.0 + increment: 0.1 + decimal: 1 + VT_SPOILER_MC_LD: + description: + short: Spoiler setting while landing (hover) + type: float + default: 0.0 + unit: norm + min: -1 + max: 1 + decimal: 1 + increment: 0.1