mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-24 07:09:48 +08:00
refactor(commander): convert params.c to module.yaml
Convert 3 parameter file(s) from legacy C format to YAML module configuration.
This commit is contained in:
@@ -63,6 +63,7 @@ px4_add_module(
|
||||
worker_thread.cpp
|
||||
MODULE_CONFIG
|
||||
module.yaml
|
||||
commander_params.yaml
|
||||
DEPENDS
|
||||
ArmAuthorization
|
||||
circuit_breaker
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2026 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* Enable Actuator Failure check
|
||||
*
|
||||
* If enabled, the HealthAndArmingChecks will verify that for motors, a minimum amount of ESC current per throttle
|
||||
* level is being consumed.
|
||||
* Otherwise this indicates an motor failure.
|
||||
* This check only works for ESCs that report current consumption.
|
||||
*
|
||||
* @boolean
|
||||
*
|
||||
* @group Motor Failure
|
||||
*/
|
||||
PARAM_DEFINE_INT32(FD_ACT_EN, 0);
|
||||
|
||||
/**
|
||||
* Motor Failure Current/Throttle Scale
|
||||
*
|
||||
* Determines the slope between expected steady state current and linearized, normalized thrust command.
|
||||
* E.g. FD_ACT_MOT_C2T A represents the expected steady state current at 100%.
|
||||
* FD_ACT_LOW_OFF and FD_ACT_HIGH_OFF offset the threshold from that slope.
|
||||
*
|
||||
* @group Motor Failure
|
||||
* @min 0.0
|
||||
* @max 50.0
|
||||
* @unit A/%
|
||||
* @decimal 2
|
||||
* @increment 1
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(MOTFAIL_C2T, 35.f);
|
||||
|
||||
/**
|
||||
* Undercurrent motor failure limit offset
|
||||
*
|
||||
* threshold = FD_ACT_MOT_C2T * thrust - FD_ACT_LOW_OFF
|
||||
*
|
||||
* @group Motor Failure
|
||||
* @min 0
|
||||
* @max 30
|
||||
* @unit A
|
||||
* @decimal 2
|
||||
* @increment 1
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(MOTFAIL_LOW_OFF, 10.f);
|
||||
|
||||
/**
|
||||
* Overcurrent motor failure limit offset
|
||||
*
|
||||
* threshold = FD_ACT_MOT_C2T * thrust + FD_ACT_HIGH_OFF
|
||||
*
|
||||
* @group Motor Failure
|
||||
* @min 0
|
||||
* @max 30
|
||||
* @unit A
|
||||
* @decimal 2
|
||||
* @increment 1
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(MOTFAIL_HIGH_OFF, 10.f);
|
||||
|
||||
/**
|
||||
* Motor Failure Hysteresis Time
|
||||
*
|
||||
* Motor failure only triggers after current thresholds are exceeded for this time.
|
||||
*
|
||||
* @group Motor Failure
|
||||
* @unit s
|
||||
* @min 0.01
|
||||
* @max 10
|
||||
* @decimal 2
|
||||
* @increment 1
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(MOTFAIL_TIME, 1.f);
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,143 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018 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 failure_detector_params.c
|
||||
*
|
||||
* Parameters used by the Failure Detector.
|
||||
*
|
||||
* @author Mathieu Bresciani <brescianimathieu@gmail.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* FailureDetector Max Roll
|
||||
*
|
||||
* Maximum roll angle before FailureDetector triggers the attitude_failure flag.
|
||||
* The flag triggers flight termination (if @CBRK_FLIGHTTERM = 0),
|
||||
* which sets outputs to their failsafe values.
|
||||
* On takeoff the flag triggers lockdown (irrespective of @CBRK_FLIGHTTERM),
|
||||
* which disarms motors but does not set outputs to failsafe values.
|
||||
*
|
||||
* Setting this parameter to 0 disables the check
|
||||
*
|
||||
* @min 0
|
||||
* @max 180
|
||||
* @unit deg
|
||||
* @group Failure Detector
|
||||
*/
|
||||
PARAM_DEFINE_INT32(FD_FAIL_R, 60);
|
||||
|
||||
/**
|
||||
* FailureDetector Max Pitch
|
||||
*
|
||||
* Maximum pitch angle before FailureDetector triggers the attitude_failure flag.
|
||||
* The flag triggers flight termination (if @CBRK_FLIGHTTERM = 0),
|
||||
* which sets outputs to their failsafe values.
|
||||
* On takeoff the flag triggers lockdown (irrespective of @CBRK_FLIGHTTERM),
|
||||
* which disarms motors but does not set outputs to failsafe values.
|
||||
*
|
||||
* Setting this parameter to 0 disables the check
|
||||
*
|
||||
* @min 0
|
||||
* @max 180
|
||||
* @unit deg
|
||||
* @group Failure Detector
|
||||
*/
|
||||
PARAM_DEFINE_INT32(FD_FAIL_P, 60);
|
||||
|
||||
/**
|
||||
* Roll failure trigger time
|
||||
*
|
||||
* Seconds (decimal) that roll has to exceed FD_FAIL_R before being considered as a failure.
|
||||
*
|
||||
* @unit s
|
||||
* @min 0.02
|
||||
* @max 5
|
||||
* @decimal 2
|
||||
*
|
||||
* @group Failure Detector
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(FD_FAIL_R_TTRI, 0.3);
|
||||
|
||||
/**
|
||||
* Pitch failure trigger time
|
||||
*
|
||||
* Seconds (decimal) that pitch has to exceed FD_FAIL_P before being considered as a failure.
|
||||
*
|
||||
* @unit s
|
||||
* @min 0.02
|
||||
* @max 5
|
||||
* @decimal 2
|
||||
*
|
||||
* @group Failure Detector
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(FD_FAIL_P_TTRI, 0.3);
|
||||
|
||||
/**
|
||||
* Enable PWM input on for engaging failsafe from an external automatic trigger system (ATS).
|
||||
*
|
||||
* Enabled on either AUX5 or MAIN5 depending on board.
|
||||
* External ATS is required by ASTM F3322-18.
|
||||
*
|
||||
* @boolean
|
||||
* @reboot_required true
|
||||
* @group Failure Detector
|
||||
*/
|
||||
PARAM_DEFINE_INT32(FD_EXT_ATS_EN, 0);
|
||||
|
||||
/**
|
||||
* The PWM threshold from external automatic trigger system for engaging failsafe.
|
||||
*
|
||||
* External ATS is required by ASTM F3322-18.
|
||||
*
|
||||
* @unit us
|
||||
* @decimal 2
|
||||
*
|
||||
* @group Failure Detector
|
||||
*/
|
||||
PARAM_DEFINE_INT32(FD_EXT_ATS_TRIG, 1900);
|
||||
|
||||
/**
|
||||
* Imbalanced propeller check threshold
|
||||
*
|
||||
* Value at which the imbalanced propeller metric (based on horizontal and
|
||||
* vertical acceleration variance) triggers a failure
|
||||
*
|
||||
* Setting this value to 0 disables the feature.
|
||||
*
|
||||
* @min 0
|
||||
* @max 1000
|
||||
* @increment 1
|
||||
* @group Failure Detector
|
||||
*/
|
||||
PARAM_DEFINE_INT32(FD_IMB_PROP_THR, 30);
|
||||
Reference in New Issue
Block a user