land detector move hysteresis constants into FW and MC

This commit is contained in:
Daniel Agar
2017-08-15 10:58:29 -04:00
parent fd8a5644e8
commit 90819b2852
6 changed files with 25 additions and 18 deletions
@@ -68,6 +68,9 @@ FixedwingLandDetector::FixedwingLandDetector() :
_paramHandle.maxClimbRate = param_find("LNDFW_VEL_Z_MAX");
_paramHandle.maxAirSpeed = param_find("LNDFW_AIRSPD_MAX");
_paramHandle.maxIntVelocity = param_find("LNDFW_VELI_MAX");
// Use Trigger time when transitioning from in-air (false) to landed (true) / ground contact (true).
_landed_hysteresis.set_hysteresis_time_from(false, LAND_DETECTOR_TRIGGER_TIME_US);
}
void FixedwingLandDetector::_initialize_topics()
@@ -105,16 +108,15 @@ bool FixedwingLandDetector::_get_freefall_state()
// TODO
return false;
}
bool FixedwingLandDetector::_get_ground_contact_state()
{
// TODO
return false;
}
bool FixedwingLandDetector::_get_maybe_landed_state()
{
// TODO
return false;
}
@@ -73,6 +73,10 @@ protected:
virtual float _get_max_altitude() override;
private:
/** Time in us that landing conditions have to hold before triggering a land. */
static constexpr uint64_t LAND_DETECTOR_TRIGGER_TIME_US = 1500000;
struct {
param_t maxVelocity;
param_t maxClimbRate;
@@ -65,10 +65,6 @@ LandDetector::LandDetector() :
_takeoff_time{0},
_work{}
{
// Use Trigger time when transitioning from in-air (false) to landed (true) / ground contact (true).
_landed_hysteresis.set_hysteresis_time_from(false, LAND_DETECTOR_TRIGGER_TIME_US);
_maybe_landed_hysteresis.set_hysteresis_time_from(false, MAYBE_LAND_DETECTOR_TRIGGER_TIME_US);
_ground_contact_hysteresis.set_hysteresis_time_from(false, GROUND_CONTACT_TRIGGER_TIME_US);
}
LandDetector::~LandDetector()
-12
View File
@@ -146,18 +146,6 @@ protected:
/** Run main land detector loop at this rate in Hz. */
static constexpr uint32_t LAND_DETECTOR_UPDATE_RATE_HZ = 50;
/** Time in us that landing conditions have to hold before triggering a land. */
static constexpr uint64_t LAND_DETECTOR_TRIGGER_TIME_US = 300000;
/** Time in us that almost landing conditions have to hold before triggering almost landed . */
static constexpr uint64_t MAYBE_LAND_DETECTOR_TRIGGER_TIME_US = 250000;
/** Time in us that ground contact condition have to hold before triggering contact ground */
static constexpr uint64_t GROUND_CONTACT_TRIGGER_TIME_US = 350000;
/** Time interval in us in which wider acceptance thresholds are used after landed. */
static constexpr uint64_t LAND_DETECTOR_LAND_PHASE_TIME_US = 2000000;
orb_advert_t _landDetectedPub;
struct vehicle_land_detected_s _landDetected;
@@ -108,6 +108,11 @@ MulticopterLandDetector::MulticopterLandDetector() :
_paramHandle.altitude_max = param_find("LNDMC_ALT_MAX");
_paramHandle.manual_stick_up_position_takeoff_threshold = param_find("LNDMC_POS_UPTHR");
_paramHandle.landSpeed = param_find("MPC_LAND_SPEED");
// Use Trigger time when transitioning from in-air (false) to landed (true) / ground contact (true).
_landed_hysteresis.set_hysteresis_time_from(false, LAND_DETECTOR_TRIGGER_TIME_US);
_maybe_landed_hysteresis.set_hysteresis_time_from(false, MAYBE_LAND_DETECTOR_TRIGGER_TIME_US);
_ground_contact_hysteresis.set_hysteresis_time_from(false, GROUND_CONTACT_TRIGGER_TIME_US);
}
void MulticopterLandDetector::_initialize_topics()
@@ -82,6 +82,18 @@ protected:
virtual float _get_max_altitude() override;
private:
/** Time in us that landing conditions have to hold before triggering a land. */
static constexpr uint64_t LAND_DETECTOR_TRIGGER_TIME_US = 300000;
/** Time in us that almost landing conditions have to hold before triggering almost landed . */
static constexpr uint64_t MAYBE_LAND_DETECTOR_TRIGGER_TIME_US = 250000;
/** Time in us that ground contact condition have to hold before triggering contact ground */
static constexpr uint64_t GROUND_CONTACT_TRIGGER_TIME_US = 350000;
/** Time interval in us in which wider acceptance thresholds are used after landed. */
static constexpr uint64_t LAND_DETECTOR_LAND_PHASE_TIME_US = 2000000;
/**
* @brief Handles for interesting parameters
**/