mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-08 01:45:44 +08:00
Land detector: Fix hover throttle detection
This commit is contained in:
committed by
Lorenz Meier
parent
f297c45f78
commit
9448b8cb52
@@ -73,6 +73,7 @@ MulticopterLandDetector::MulticopterLandDetector() : LandDetector(),
|
||||
_paramHandle.maxVelocity = param_find("LNDMC_XY_VEL_MAX");
|
||||
_paramHandle.maxClimbRate = param_find("LNDMC_Z_VEL_MAX");
|
||||
_paramHandle.minThrottle = param_find("MPC_THR_MIN");
|
||||
_paramHandle.hoverThrottleAuto = param_find("MPC_THR_HOVER");
|
||||
_paramHandle.minManThrottle = param_find("MPC_MANTHR_MIN");
|
||||
_paramHandle.freefall_acc_threshold = param_find("LNDMC_FFALL_THR");
|
||||
_paramHandle.freefall_trigger_time = param_find("LNDMC_FFALL_TTRI");
|
||||
@@ -109,6 +110,7 @@ void MulticopterLandDetector::_update_params()
|
||||
param_get(_paramHandle.maxRotation, &_params.maxRotation_rad_s);
|
||||
_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.minManThrottle, &_params.minManThrottle);
|
||||
param_get(_paramHandle.freefall_acc_threshold, &_params.freefall_acc_threshold);
|
||||
param_get(_paramHandle.freefall_trigger_time, &_params.freefall_trigger_time);
|
||||
@@ -141,7 +143,8 @@ bool MulticopterLandDetector::_get_ground_contact_state()
|
||||
// Time base for this function
|
||||
const uint64_t now = hrt_absolute_time();
|
||||
|
||||
float sys_min_throttle = (_params.minThrottle + 0.2f);
|
||||
// 10% of throttle range between min and hover
|
||||
float sys_min_throttle = _params.minThrottle + (_params.hoverThrottleAuto - _params.minThrottle) * 0.1f;
|
||||
|
||||
// Determine the system min throttle based on flight mode
|
||||
if (!_control_mode.flag_control_altitude_enabled) {
|
||||
|
||||
@@ -84,6 +84,7 @@ private:
|
||||
param_t maxVelocity;
|
||||
param_t maxRotation;
|
||||
param_t minThrottle;
|
||||
param_t hoverThrottleAuto;
|
||||
param_t minManThrottle;
|
||||
param_t freefall_acc_threshold;
|
||||
param_t freefall_trigger_time;
|
||||
@@ -94,6 +95,7 @@ private:
|
||||
float maxVelocity;
|
||||
float maxRotation_rad_s;
|
||||
float minThrottle;
|
||||
float hoverThrottleAuto;
|
||||
float minManThrottle;
|
||||
float freefall_acc_threshold;
|
||||
float freefall_trigger_time;
|
||||
|
||||
Reference in New Issue
Block a user