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

Convert 3 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 af4d7d0f5a
commit 0d4d988260
7 changed files with 144 additions and 262 deletions

View File

@@ -42,6 +42,10 @@ px4_add_module(
VtolLandDetector.cpp
RoverLandDetector.cpp
AirshipLandDetector.cpp
MODULE_CONFIG
land_detector_params.yaml
land_detector_params_fw.yaml
land_detector_params_mc.yaml
DEPENDS
hysteresis
)

View File

@@ -1,60 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2014-2016 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.
*
****************************************************************************/
/**
* Total flight time in microseconds
*
* Total flight time of this autopilot. Higher 32 bits of the value.
* Flight time in microseconds = (LND_FLIGHT_T_HI << 32) | LND_FLIGHT_T_LO.
*
* @min 0
* @volatile
* @category system
* @group Land Detector
*
*/
PARAM_DEFINE_INT32(LND_FLIGHT_T_HI, 0);
/**
* Total flight time in microseconds
*
* Total flight time of this autopilot. Lower 32 bits of the value.
* Flight time in microseconds = (LND_FLIGHT_T_HI << 32) | LND_FLIGHT_T_LO.
*
* @min 0
* @volatile
* @category system
* @group Land Detector
*
*/
PARAM_DEFINE_INT32(LND_FLIGHT_T_LO, 0);

View File

@@ -0,0 +1,26 @@
module_name: land_detector
parameters:
- group: Land Detector
definitions:
LND_FLIGHT_T_HI:
description:
short: Total flight time in microseconds
long: |-
Total flight time of this autopilot. Higher 32 bits of the value.
Flight time in microseconds = (LND_FLIGHT_T_HI << 32) | LND_FLIGHT_T_LO.
category: System
type: int32
default: 0
volatile: true
min: 0
LND_FLIGHT_T_LO:
description:
short: Total flight time in microseconds
long: |-
Total flight time of this autopilot. Lower 32 bits of the value.
Flight time in microseconds = (LND_FLIGHT_T_HI << 32) | LND_FLIGHT_T_LO.
category: System
type: int32
default: 0
volatile: true
min: 0

View File

@@ -1,116 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2014-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.
*
****************************************************************************/
/**
* Fixed-wing land detector: Max horizontal velocity threshold
*
* Maximum horizontal velocity allowed in the landed state.
* A factor of 0.7 is applied in case of airspeed-less flying
* (either because no sensor is present or sensor data got invalid in flight).
*
* @unit m/s
* @min 0.5
* @max 20
* @decimal 1
*
* @group Land Detector
*/
PARAM_DEFINE_FLOAT(LNDFW_VEL_XY_MAX, 5.0f);
/**
* Fixed-wing land detector: Max vertiacal velocity threshold
*
* Maximum vertical velocity allowed in the landed state.
*
* @unit m/s
* @min 0.1
* @max 20
* @decimal 1
*
* @group Land Detector
*/
PARAM_DEFINE_FLOAT(LNDFW_VEL_Z_MAX, 1.0f);
/**
* Fixed-wing land detector: Max horizontal acceleration
*
* Maximum horizontal (x,y body axes) acceleration allowed in the landed state
*
* @unit m/s^2
* @min 2
* @max 30
* @decimal 1
*
* @group Land Detector
*/
PARAM_DEFINE_FLOAT(LNDFW_XYACC_MAX, 8.0f);
/**
* Fixed-wing land detector: Max airspeed
*
* Maximum airspeed allowed in the landed state
*
* @unit m/s
* @min 2
* @max 30
* @decimal 1
*
* @group Land Detector
*/
PARAM_DEFINE_FLOAT(LNDFW_AIRSPD_MAX, 6.00f);
/**
* Fixed-wing land detection trigger time
*
* Time the land conditions (speeds and acceleration) have to be satisfied to detect a landing.
*
* @unit s
* @min 0.1
* @decimal 1
*
* @reboot_required true
* @group Land Detector
*/
PARAM_DEFINE_FLOAT(LNDFW_TRIG_TIME, 2.f);
/**
* Fixed-wing land detector: max rotational speed
*
* Maximum allowed norm of the angular velocity in the landed state.
* Only used if neither airspeed nor groundspeed can be used for landing detection.
*
* @unit deg/s
* @decimal 1
* @group Land Detector
*/
PARAM_DEFINE_FLOAT(LNDFW_ROT_MAX, 0.5f);

View File

@@ -0,0 +1,69 @@
module_name: land_detector
parameters:
- group: Land Detector
definitions:
LNDFW_VEL_XY_MAX:
description:
short: 'Fixed-wing land detector: Max horizontal velocity threshold'
long: |-
Maximum horizontal velocity allowed in the landed state.
A factor of 0.7 is applied in case of airspeed-less flying
(either because no sensor is present or sensor data got invalid in flight).
type: float
default: 5.0
unit: m/s
min: 0.5
max: 20
decimal: 1
LNDFW_VEL_Z_MAX:
description:
short: 'Fixed-wing land detector: Max vertiacal velocity threshold'
long: Maximum vertical velocity allowed in the landed state.
type: float
default: 1.0
unit: m/s
min: 0.1
max: 20
decimal: 1
LNDFW_XYACC_MAX:
description:
short: 'Fixed-wing land detector: Max horizontal acceleration'
long: Maximum horizontal (x,y body axes) acceleration allowed in the landed
state
type: float
default: 8.0
unit: m/s^2
min: 2
max: 30
decimal: 1
LNDFW_AIRSPD_MAX:
description:
short: 'Fixed-wing land detector: Max airspeed'
long: Maximum airspeed allowed in the landed state
type: float
default: 6.0
unit: m/s
min: 2
max: 30
decimal: 1
LNDFW_TRIG_TIME:
description:
short: Fixed-wing land detection trigger time
long: Time the land conditions (speeds and acceleration) have to be satisfied
to detect a landing.
type: float
default: 2.0
unit: s
min: 0.1
decimal: 1
reboot_required: true
LNDFW_ROT_MAX:
description:
short: 'Fixed-wing land detector: max rotational speed'
long: |-
Maximum allowed norm of the angular velocity in the landed state.
Only used if neither airspeed nor groundspeed can be used for landing detection.
type: float
default: 0.5
unit: deg/s
decimal: 1

View File

@@ -1,86 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2014-2016 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.
*
****************************************************************************/
/**
* Multicopter vertical velocity threshold
*
* Vertical velocity threshold to detect landing.
* Has to be set lower than the expected minimal speed for landing,
* which is either MPC_LAND_SPEED or MPC_LAND_CRWL.
* This is enforced by an automatic check.
*
* @unit m/s
* @min 0
* @decimal 2
*
* @group Land Detector
*/
PARAM_DEFINE_FLOAT(LNDMC_Z_VEL_MAX, 0.25f);
/**
* Multicopter max horizontal velocity
*
* Maximum horizontal velocity allowed in the landed state
*
* @unit m/s
* @decimal 1
*
* @group Land Detector
*/
PARAM_DEFINE_FLOAT(LNDMC_XY_VEL_MAX, 1.5f);
/**
* Multicopter max rotational speed
*
* Maximum allowed norm of the angular velocity (roll, pitch) in the landed state.
*
* @unit deg/s
* @decimal 1
*
* @group Land Detector
*/
PARAM_DEFINE_FLOAT(LNDMC_ROT_MAX, 20.0f);
/**
* Ground effect altitude for multicopters
*
* The height above ground below which ground effect creates barometric altitude errors.
* A negative value indicates no ground effect.
*
* @unit m
* @min -1
* @decimal 2
* @group Land Detector
*
*/
PARAM_DEFINE_FLOAT(LNDMC_ALT_GND, 2.f);

View File

@@ -0,0 +1,45 @@
module_name: land_detector
parameters:
- group: Land Detector
definitions:
LNDMC_Z_VEL_MAX:
description:
short: Multicopter vertical velocity threshold
long: |-
Vertical velocity threshold to detect landing.
Has to be set lower than the expected minimal speed for landing,
which is either MPC_LAND_SPEED or MPC_LAND_CRWL.
This is enforced by an automatic check.
type: float
default: 0.25
unit: m/s
min: 0
decimal: 2
LNDMC_XY_VEL_MAX:
description:
short: Multicopter max horizontal velocity
long: Maximum horizontal velocity allowed in the landed state
type: float
default: 1.5
unit: m/s
decimal: 1
LNDMC_ROT_MAX:
description:
short: Multicopter max rotational speed
long: Maximum allowed norm of the angular velocity (roll, pitch) in the landed
state.
type: float
default: 20.0
unit: deg/s
decimal: 1
LNDMC_ALT_GND:
description:
short: Ground effect altitude for multicopters
long: |-
The height above ground below which ground effect creates barometric altitude errors.
A negative value indicates no ground effect.
type: float
default: 2.0
unit: m
min: -1
decimal: 2