land_detector: added a parameter for the manual land detection stick throshold

because it is definitely something that needs to be allowed to tune or disable for different application scenarios
This commit is contained in:
Matthias Grob
2017-02-23 13:18:49 +01:00
committed by Lorenz Meier
parent ef228b82aa
commit e6031a97fa
3 changed files with 20 additions and 1 deletions
@@ -78,6 +78,7 @@ MulticopterLandDetector::MulticopterLandDetector() : LandDetector(),
_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");
_paramHandle.manual_stick_down_threshold = param_find("LNDMC_MAN_DWNTHR");
}
void MulticopterLandDetector::_initialize_topics()
@@ -117,6 +118,7 @@ void MulticopterLandDetector::_update_params()
param_get(_paramHandle.freefall_acc_threshold, &_params.freefall_acc_threshold);
param_get(_paramHandle.freefall_trigger_time, &_params.freefall_trigger_time);
_freefall_hysteresis.set_hysteresis_time_from(false, (hrt_abstime)(1e6f * _params.freefall_trigger_time));
param_get(_paramHandle.manual_stick_down_threshold, &_params.manual_stick_down_threshold);
}
@@ -158,7 +160,7 @@ bool MulticopterLandDetector::_get_ground_contact_state()
// Check if user commands throttle and if so, report no ground contact based on
// the user intent to take off (even if the system might physically still have
// ground contact at this point).
const bool manual_control_idle = (_has_manual_control_present() && _manual.z < 0.15f);
const bool manual_control_idle = (_has_manual_control_present() && _manual.z < _params.manual_stick_down_threshold);
const bool manual_control_idle_or_auto = manual_control_idle || !_control_mode.flag_control_manual_enabled;
// Widen acceptance thresholds for landed state right after arming