mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Land detector: Turn throttle range parameter into proper user-configurable parameter
This commit is contained in:
parent
9448b8cb52
commit
9ef97b78c8
@ -72,6 +72,7 @@ MulticopterLandDetector::MulticopterLandDetector() : LandDetector(),
|
||||
_paramHandle.maxRotation = param_find("LNDMC_ROT_MAX");
|
||||
_paramHandle.maxVelocity = param_find("LNDMC_XY_VEL_MAX");
|
||||
_paramHandle.maxClimbRate = param_find("LNDMC_Z_VEL_MAX");
|
||||
_paramHandle.throttleRange = param_find("LNDMC_THR_RANGE");
|
||||
_paramHandle.minThrottle = param_find("MPC_THR_MIN");
|
||||
_paramHandle.hoverThrottleAuto = param_find("MPC_THR_HOVER");
|
||||
_paramHandle.minManThrottle = param_find("MPC_MANTHR_MIN");
|
||||
@ -111,6 +112,7 @@ void MulticopterLandDetector::_update_params()
|
||||
_params.maxRotation_rad_s = math::radians(_params.maxRotation_rad_s);
|
||||
param_get(_paramHandle.minThrottle, &_params.minThrottle);
|
||||
param_get(_paramHandle.hoverThrottleAuto, &_params.hoverThrottleAuto);
|
||||
param_get(_paramHandle.throttleRange, &_params.throttleRange);
|
||||
param_get(_paramHandle.minManThrottle, &_params.minManThrottle);
|
||||
param_get(_paramHandle.freefall_acc_threshold, &_params.freefall_acc_threshold);
|
||||
param_get(_paramHandle.freefall_trigger_time, &_params.freefall_trigger_time);
|
||||
@ -144,7 +146,8 @@ bool MulticopterLandDetector::_get_ground_contact_state()
|
||||
const uint64_t now = hrt_absolute_time();
|
||||
|
||||
// 10% of throttle range between min and hover
|
||||
float sys_min_throttle = _params.minThrottle + (_params.hoverThrottleAuto - _params.minThrottle) * 0.1f;
|
||||
float sys_min_throttle = _params.minThrottle + (_params.hoverThrottleAuto - _params.minThrottle) *
|
||||
_params.throttleRange;
|
||||
|
||||
// Determine the system min throttle based on flight mode
|
||||
if (!_control_mode.flag_control_altitude_enabled) {
|
||||
|
||||
@ -85,6 +85,7 @@ private:
|
||||
param_t maxRotation;
|
||||
param_t minThrottle;
|
||||
param_t hoverThrottleAuto;
|
||||
param_t throttleRange;
|
||||
param_t minManThrottle;
|
||||
param_t freefall_acc_threshold;
|
||||
param_t freefall_trigger_time;
|
||||
@ -96,6 +97,7 @@ private:
|
||||
float maxRotation_rad_s;
|
||||
float minThrottle;
|
||||
float hoverThrottleAuto;
|
||||
float throttleRange;
|
||||
float minManThrottle;
|
||||
float freefall_acc_threshold;
|
||||
float freefall_trigger_time;
|
||||
|
||||
@ -88,6 +88,22 @@ PARAM_DEFINE_FLOAT(LNDMC_ROT_MAX, 20.0f);
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(LNDMC_FFALL_THR, 2.0f);
|
||||
|
||||
/**
|
||||
* Multicopter sub-hover throttle scaling
|
||||
*
|
||||
* The range between throttle_min and throttle_hover is scaled
|
||||
* by this parameter to define how close to minimum throttle
|
||||
* the current throttle value needs to be in order to get
|
||||
* accepted as landed.
|
||||
*
|
||||
* @min 0.05
|
||||
* @max 0.5
|
||||
* @decimal 2
|
||||
*
|
||||
* @group Land Detector
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(LNDMC_THR_RANGE, 0.1f);
|
||||
|
||||
/**
|
||||
* Multicopter free-fall trigger time
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user