mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-24 15:40:31 +08:00
MCLandDetector: clean up logic for ground effect
Before: in_ground_effect was always true with the default settings (LNDMC_ALT_GND =-1) and when a distance sensor was present with valid data. Now: default of LNDMC_ALT_GND is set to 2m by default, and if set to a negative value then in_ground_effect is never set to true Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
@@ -187,8 +187,8 @@ bool MulticopterLandDetector::_get_ground_contact_state()
|
||||
_horizontal_movement = false; // not known
|
||||
}
|
||||
|
||||
if (lpos_available && _vehicle_local_position.dist_bottom_valid) {
|
||||
_below_gnd_effect_hgt = _vehicle_local_position.dist_bottom < _get_gnd_effect_altitude();
|
||||
if (lpos_available && _vehicle_local_position.dist_bottom_valid && _param_lndmc_alt_gnd_effect.get() > 0) {
|
||||
_below_gnd_effect_hgt = _vehicle_local_position.dist_bottom < _param_lndmc_alt_gnd_effect.get();
|
||||
|
||||
} else {
|
||||
_below_gnd_effect_hgt = false;
|
||||
@@ -323,16 +323,6 @@ bool MulticopterLandDetector::_get_landed_state()
|
||||
return _maybe_landed_hysteresis.get_state();
|
||||
}
|
||||
|
||||
float MulticopterLandDetector::_get_gnd_effect_altitude()
|
||||
{
|
||||
if (_param_lndmc_alt_gnd_effect.get() < 0.0f) {
|
||||
return INFINITY;
|
||||
|
||||
} else {
|
||||
return _param_lndmc_alt_gnd_effect.get();
|
||||
}
|
||||
}
|
||||
|
||||
bool MulticopterLandDetector::_get_ground_effect_state()
|
||||
{
|
||||
return (_in_descend && !_horizontal_movement) ||
|
||||
|
||||
@@ -79,8 +79,6 @@ protected:
|
||||
|
||||
void _set_hysteresis_factor(const int factor) override;
|
||||
private:
|
||||
|
||||
float _get_gnd_effect_altitude();
|
||||
bool _is_close_to_ground();
|
||||
|
||||
/** Time in us that freefall has to hold before triggering freefall */
|
||||
|
||||
@@ -113,4 +113,4 @@ PARAM_DEFINE_FLOAT(LNDMC_ALT_MAX, -1.0f);
|
||||
* @group Land Detector
|
||||
*
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(LNDMC_ALT_GND, -1.0f);
|
||||
PARAM_DEFINE_FLOAT(LNDMC_ALT_GND, 2.f);
|
||||
|
||||
Reference in New Issue
Block a user