refactor(fw_autotune_attitude_control): convert params.c to module.yaml

Convert 1 parameter file(s) from legacy C format to YAML
module configuration.
This commit is contained in:
Jacob Dahl 2026-03-17 21:55:34 -08:00 committed by Jacob Dahl
parent a0e6e8a240
commit 9fc2289e00
3 changed files with 94 additions and 144 deletions

View File

@ -39,6 +39,8 @@ px4_add_module(
SRCS
fw_autotune_attitude_control.cpp
fw_autotune_attitude_control.hpp
MODULE_CONFIG
fw_autotune_attitude_control_params.yaml
DEPENDS
hysteresis
mathlib

View File

@ -1,144 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2020-2021 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_autotune_attitude_control_params.c
*
* Parameters used by the attitude auto-tuner
*
* @author Mathieu Bresciani <mathieu@auterion.com>
*/
/**
* Controls when to apply the new gains
*
* After the auto-tuning sequence is completed,
* a new set of gains is available and can be applied
* immediately or after landing.
*
* @value 0 Do not apply the new gains (logging only)
* @value 1 Apply the new gains after disarm
* @value 2 Apply the new gains in air
* @group Autotune
*/
PARAM_DEFINE_INT32(FW_AT_APPLY, 2);
/**
* Tuning axes selection
*
* Defines which axes will be tuned during the auto-tuning sequence
*
* Set bits in the following positions to enable:
* 0 : Roll
* 1 : Pitch
* 2 : Yaw
*
* @bit 0 roll
* @bit 1 pitch
* @bit 2 yaw
* @min 1
* @max 7
* @group Autotune
*/
PARAM_DEFINE_INT32(FW_AT_AXES, 3);
/**
* Enable/disable auto tuning using a manual control AUX input
*
* Defines which RC_MAP_AUXn parameter maps the manual control channel used to enable/disable auto tuning.
*
* @value 0 Disable
* @value 1 Aux1
* @value 2 Aux2
* @value 3 Aux3
* @value 4 Aux4
* @value 5 Aux5
* @value 6 Aux6
* @min 0
* @max 6
* @group Autotune
*/
PARAM_DEFINE_INT32(FW_AT_MAN_AUX, 0);
/**
* Start frequency of the injected signal
*
* Can be set lower or higher than the end frequency
*
* @min 0.1
* @max 30.0
* @decimal 1
* @unit Hz
* @group Autotune
*/
PARAM_DEFINE_FLOAT(FW_AT_SYSID_F0, 1.f);
/**
* End frequency of the injected signal
*
* Can be set lower or higher than the start frequency
*
* @min 0.1
* @max 30.0
* @decimal 1
* @unit Hz
* @group Autotune
*/
PARAM_DEFINE_FLOAT(FW_AT_SYSID_F1, 10.f);
/**
* Maneuver time for each axis
*
* Duration of the input signal sent on each axis during system identification
*
* @min 5
* @max 120
* @decimal 0
* @unit s
* @group Autotune
*/
PARAM_DEFINE_FLOAT(FW_AT_SYSID_TIME, 10.f);
/**
* Input signal type
*
* Type of signal used during system identification to excite the system.
*
* @value 0 Step
* @value 1 Linear sine sweep
* @value 2 Logarithmic sine sweep
* @group Autotune
*/
PARAM_DEFINE_INT32(FW_AT_SYSID_TYPE, 1);

View File

@ -0,0 +1,92 @@
module_name: fw_autotune_attitude_control
parameters:
- group: Autotune
definitions:
FW_AT_APPLY:
description:
short: Controls when to apply the new gains
long: |-
After the auto-tuning sequence is completed,
a new set of gains is available and can be applied
immediately or after landing.
type: enum
values:
0: Do not apply the new gains (logging only)
1: Apply the new gains after disarm
2: Apply the new gains in air
default: 2
FW_AT_AXES:
description:
short: Tuning axes selection
long: |-
Defines which axes will be tuned during the auto-tuning sequence
Set bits in the following positions to enable:
0 : Roll
1 : Pitch
2 : Yaw
type: bitmask
bit:
0: roll
1: pitch
2: yaw
default: 3
min: 1
max: 7
FW_AT_MAN_AUX:
description:
short: Enable/disable auto tuning using a manual control AUX input
long: Defines which RC_MAP_AUXn parameter maps the manual control channel
used to enable/disable auto tuning.
type: enum
values:
0: Disable
1: Aux1
2: Aux2
3: Aux3
4: Aux4
5: Aux5
6: Aux6
default: 0
min: 0
max: 6
FW_AT_SYSID_F0:
description:
short: Start frequency of the injected signal
long: Can be set lower or higher than the end frequency
type: float
default: 1.0
min: 0.1
max: 30.0
decimal: 1
unit: Hz
FW_AT_SYSID_F1:
description:
short: End frequency of the injected signal
long: Can be set lower or higher than the start frequency
type: float
default: 10.0
min: 0.1
max: 30.0
decimal: 1
unit: Hz
FW_AT_SYSID_TIME:
description:
short: Maneuver time for each axis
long: Duration of the input signal sent on each axis during system identification
type: float
default: 10.0
min: 5
max: 120
decimal: 0
unit: s
FW_AT_SYSID_TYPE:
description:
short: Input signal type
long: Type of signal used during system identification to excite the system.
type: enum
values:
0: Step
1: Linear sine sweep
2: Logarithmic sine sweep
default: 1