diff --git a/src/modules/land_detector/MulticopterLandDetector.cpp b/src/modules/land_detector/MulticopterLandDetector.cpp index ecc795055d..a7367f934c 100644 --- a/src/modules/land_detector/MulticopterLandDetector.cpp +++ b/src/modules/land_detector/MulticopterLandDetector.cpp @@ -70,7 +70,7 @@ MulticopterLandDetector::MulticopterLandDetector() : LandDetector(), _paramHandle.maxClimbRate = param_find("LNDMC_Z_VEL_MAX"); _paramHandle.maxThrottle = param_find("LNDMC_THR_MAX"); _paramHandle.acc_threshold_m_s2 = param_find("LNDMC_FFALL_THR"); - _paramHandle.ff_trigger_time_ms = param_find("LNDMC_FFALL_TRIG"); + _paramHandle.ff_trigger_time = param_find("LNDMC_FFALL_TTRI"); } void MulticopterLandDetector::initialize() @@ -139,7 +139,7 @@ bool MulticopterLandDetector::get_freefall_state() return false; } - return (now - _freefallTimer) / 1000 > _params.ff_trigger_time_ms; + return (now - _freefallTimer) / 1000000.0f > _params.ff_trigger_time; } bool MulticopterLandDetector::get_landed_state() @@ -225,7 +225,7 @@ void MulticopterLandDetector::updateParameterCache(const bool force) _params.maxRotation_rad_s = math::radians(_params.maxRotation_rad_s); param_get(_paramHandle.maxThrottle, &_params.maxThrottle); param_get(_paramHandle.acc_threshold_m_s2, &_params.acc_threshold_m_s2); - param_get(_paramHandle.ff_trigger_time_ms, &_params.ff_trigger_time_ms); + param_get(_paramHandle.ff_trigger_time, &_params.ff_trigger_time); } } diff --git a/src/modules/land_detector/MulticopterLandDetector.h b/src/modules/land_detector/MulticopterLandDetector.h index 387a557622..b842b0b956 100644 --- a/src/modules/land_detector/MulticopterLandDetector.h +++ b/src/modules/land_detector/MulticopterLandDetector.h @@ -103,7 +103,7 @@ private: param_t maxRotation; param_t maxThrottle; param_t acc_threshold_m_s2; - param_t ff_trigger_time_ms; + param_t ff_trigger_time; } _paramHandle; struct { @@ -112,7 +112,7 @@ private: float maxRotation_rad_s; float maxThrottle; float acc_threshold_m_s2; - uint32_t ff_trigger_time_ms; + float ff_trigger_time; } _params; private: diff --git a/src/modules/land_detector/land_detector_params.c b/src/modules/land_detector/land_detector_params.c index c06a21ba07..99f55f5f4c 100644 --- a/src/modules/land_detector/land_detector_params.c +++ b/src/modules/land_detector/land_detector_params.c @@ -44,6 +44,7 @@ * Maximum vertical velocity allowed in the landed state (m/s up and down) * * @unit m/s + * @decimal 1 * * @group Land Detector */ @@ -55,6 +56,7 @@ PARAM_DEFINE_FLOAT(LNDMC_Z_VEL_MAX, 0.70f); * Maximum horizontal velocity allowed in the landed state (m/s) * * @unit m/s + * @decimal 1 * * @group Land Detector */ @@ -66,6 +68,7 @@ PARAM_DEFINE_FLOAT(LNDMC_XY_VEL_MAX, 1.50f); * Maximum allowed angular velocity around each axis allowed in the landed state. * * @unit deg/s + * @decimal 1 * * @group Land Detector */ @@ -76,8 +79,10 @@ PARAM_DEFINE_FLOAT(LNDMC_ROT_MAX, 20.0f); * * Maximum actuator output on throttle allowed in the landed state * + * @unit norm * @min 0.1 * @max 0.5 + * @decimal 2 * * @group Land Detector */ @@ -88,8 +93,10 @@ PARAM_DEFINE_FLOAT(LNDMC_THR_MAX, 0.15f); * * Multicopter threshold on the specific force measured by accelerometers in m/s^2 for free-fall detection * + * @unit m/s^2 * @min 0.1 * @max 10 + * @decimal 2 * * @group Land Detector */ @@ -101,12 +108,14 @@ PARAM_DEFINE_FLOAT(LNDMC_FFALL_THR, 2.0f); * Milliseconds that freefall conditions have to hold before triggering a freefall. * Minimal value is limited by LAND_DETECTOR_UPDATE_RATE=50Hz in landDetector.h * - * @min 20 - * @max 5000 + * @unit s + * @min 0.02 + * @max 5 + * @decimal 2 * * @group Land Detector */ -PARAM_DEFINE_INT32(LNDMC_FFALL_TRIG, 300); +PARAM_DEFINE_FLOAT(LNDMC_FFALL_TTRI, 0.3); /** * Fixedwing max horizontal velocity @@ -116,6 +125,7 @@ PARAM_DEFINE_INT32(LNDMC_FFALL_TRIG, 300); * @unit m/s * @min 0.5 * @max 10 + * @decimal 1 * * @group Land Detector */ @@ -129,6 +139,7 @@ PARAM_DEFINE_FLOAT(LNDFW_VEL_XY_MAX, 5.0f); * @unit m/s * @min 5 * @max 20 + * @decimal 1 * * @group Land Detector */ @@ -142,6 +153,7 @@ PARAM_DEFINE_FLOAT(LNDFW_VEL_Z_MAX, 10.0f); * @unit m/s * @min 2 * @max 10 + * @decimal 1 * * @group Land Detector */ @@ -155,6 +167,7 @@ PARAM_DEFINE_FLOAT(LNDFW_VELI_MAX, 4.0f); * @unit m/s * @min 4 * @max 20 + * @decimal 1 * * @group Land Detector */