Remove relaying of maximum altitude through land detector

This commit is contained in:
Matthias Grob
2022-01-05 14:54:59 +01:00
parent 2445fa8b4c
commit bbb04ab4b8
11 changed files with 15 additions and 40 deletions
+1 -4
View File
@@ -122,7 +122,6 @@ void LandDetector::Run()
const bool ground_contactDetected = _ground_contact_hysteresis.get_state();
const bool maybe_landedDetected = _maybe_landed_hysteresis.get_state();
const bool landDetected = _landed_hysteresis.get_state();
const float alt_max = _get_max_altitude() > 0.0f ? _get_max_altitude() : (float)INFINITY;
const bool in_ground_effect = _ground_effect_hysteresis.get_state();
// publish at 1 Hz, very first time, or when the result has changed
@@ -131,8 +130,7 @@ void LandDetector::Run()
(_land_detected.freefall != freefallDetected) ||
(_land_detected.maybe_landed != maybe_landedDetected) ||
(_land_detected.ground_contact != ground_contactDetected) ||
(_land_detected.in_ground_effect != in_ground_effect) ||
(fabsf(_land_detected.alt_max - alt_max) > FLT_EPSILON)) {
(_land_detected.in_ground_effect != in_ground_effect)) {
if (!landDetected && _land_detected.landed && _takeoff_time == 0) { /* only set take off time once, until disarming */
// We did take off
@@ -143,7 +141,6 @@ void LandDetector::Run()
_land_detected.freefall = freefallDetected;
_land_detected.maybe_landed = maybe_landedDetected;
_land_detected.ground_contact = ground_contactDetected;
_land_detected.alt_max = alt_max;
_land_detected.in_ground_effect = in_ground_effect;
_land_detected.in_descend = _get_in_descend();
_land_detected.has_low_throttle = _get_has_low_throttle();
-6
View File
@@ -126,11 +126,6 @@ protected:
*/
virtual bool _get_freefall_state() { return false; }
/**
* @return maximum altitude that can be reached
*/
virtual float _get_max_altitude() { return INFINITY; }
/**
* @return true if vehicle could be in ground effect (close to ground)
*/
@@ -163,7 +158,6 @@ private:
vehicle_land_detected_s _land_detected = {
.timestamp = 0,
.alt_max = -1.0f,
.freefall = false,
.ground_contact = true,
.maybe_landed = true,
@@ -323,16 +323,6 @@ bool MulticopterLandDetector::_get_landed_state()
return _maybe_landed_hysteresis.get_state();
}
float MulticopterLandDetector::_get_max_altitude()
{
if (_param_lndmc_alt_max.get() < 0.0f) {
return INFINITY;
} else {
return _param_lndmc_alt_max.get();
}
}
float MulticopterLandDetector::_get_gnd_effect_altitude()
{
if (_param_lndmc_alt_gnd_effect.get() < 0.0f) {
@@ -76,7 +76,6 @@ protected:
bool _get_horizontal_movement() override { return _horizontal_movement; }
bool _get_vertical_movement() override { return _vertical_movement; }
bool _get_close_to_ground_or_skipped_check() override { return _close_to_ground_or_skipped_check; }
float _get_max_altitude() override;
void _set_hysteresis_factor(const int factor) override;
private:
@@ -140,7 +139,6 @@ private:
DEFINE_PARAMETERS_CUSTOM_PARENT(
LandDetector,
(ParamFloat<px4::params::LNDMC_TRIG_TIME>) _param_lndmc_trig_time,
(ParamFloat<px4::params::LNDMC_ALT_MAX>) _param_lndmc_alt_max,
(ParamFloat<px4::params::LNDMC_ROT_MAX>) _param_lndmc_rot_max,
(ParamFloat<px4::params::LNDMC_XY_VEL_MAX>) _param_lndmc_xy_vel_max,
(ParamFloat<px4::params::LNDMC_Z_VEL_MAX>) _param_lndmc_z_vel_max,