refactor(mc_nn_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 d2d306012c
commit 397cd8375c
3 changed files with 44 additions and 83 deletions

View File

@@ -44,6 +44,8 @@ px4_add_module(
mc_nn_control.hpp
control_net.cpp
control_net.hpp
MODULE_CONFIG
mc_nn_control_params.yaml
DEPENDS
tensorflow_lite_micro
px4_work_queue

View File

@@ -1,83 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2025 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 mc_nn_control_params.c
* Parameters for the Multicopter Neural Network Control module
*
* @author Sindre Meyer Hegre <sindre.hegre@gmail.com>
*/
/**
* If true the neural network control is automatically started on boot.
*
* @boolean
* @group Neural Control
*/
PARAM_DEFINE_INT32(MC_NN_EN, 1);
/**
* The maximum RPM of the motors. Used to normalize the output of the neural network.
*
* @min 0
* @max 80000
* @group Neural Control
*/
PARAM_DEFINE_INT32(MC_NN_MAX_RPM, 22000);
/**
* The minimum RPM of the motors. Used to normalize the output of the neural network.
*
* @min 0
* @max 80000
* @group Neural Control
*/
PARAM_DEFINE_INT32(MC_NN_MIN_RPM, 1000);
/**
* Thrust coefficient of the motors. Used to normalize the output of the neural network. Divided by 100 000
*
* @min 0.0
* @max 5.0
* @group Neural Control
*/
PARAM_DEFINE_FLOAT(MC_NN_THRST_COEF, 1.2f);
/**
* Enable or disable setting the trajectory setpoint with manual control.
*
* @boolean
* @reboot_required true
* @group Neural Control
*/
PARAM_DEFINE_INT32(MC_NN_MANL_CTRL, 1);

View File

@@ -0,0 +1,42 @@
module_name: mc_nn_control
parameters:
- group: Neural Control
definitions:
MC_NN_EN:
description:
short: If true the neural network control is automatically started on boot
type: boolean
default: 1
MC_NN_MAX_RPM:
description:
short: Max motor RPM for neural network normalization
long: The maximum RPM of the motors. Used to normalize the output of the neural
network
type: int32
default: 22000
min: 0
max: 80000
MC_NN_MIN_RPM:
description:
short: Min motor RPM for neural network normalization
long: The minimum RPM of the motors. Used to normalize the output of the neural
network
type: int32
default: 1000
min: 0
max: 80000
MC_NN_THRST_COEF:
description:
short: Motor thrust coefficient for NN normalization
long: Thrust coefficient of the motors. Used to normalize the output of the
neural network. Divided by 100 000
type: float
default: 1.2
min: 0.0
max: 5.0
MC_NN_MANL_CTRL:
description:
short: Enable or disable setting the trajectory setpoint with manual control
type: boolean
default: 1
reboot_required: true