AirspeedSelector: parameter clean up and disable re-enabling if clear delay negative

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2020-12-23 23:00:51 +01:00
parent 98d057b8c9
commit 28f9214e56
3 changed files with 13 additions and 11 deletions
@@ -227,7 +227,8 @@ AirspeedValidator::update_airspeed_valid_status(const uint64_t timestamp)
_airspeed_valid = false;
}
} else if ((timestamp - _time_checks_failed) > _checks_clear_delay * 1_s) {
} else if (_checks_clear_delay > 0.f && (timestamp - _time_checks_failed) > _checks_clear_delay * 1_s) {
// disable the re-enabling if the clear delay is negative
_airspeed_valid = true;
}
}
@@ -165,8 +165,8 @@ private:
(ParamFloat<px4::params::ASPD_FS_INNOV>) _tas_innov_threshold, /**< innovation check threshold */
(ParamFloat<px4::params::ASPD_FS_INTEG>) _tas_innov_integ_threshold, /**< innovation check integrator threshold */
(ParamInt<px4::params::ASPD_FS_T1>) _checks_fail_delay, /**< delay to declare airspeed invalid */
(ParamInt<px4::params::ASPD_FS_T2>) _checks_clear_delay, /**< delay to declare airspeed valid again */
(ParamInt<px4::params::ASPD_FS_T_STOP>) _checks_fail_delay, /**< delay to declare airspeed invalid */
(ParamInt<px4::params::ASPD_FS_T_START>) _checks_clear_delay, /**< delay to declare airspeed valid again */
(ParamFloat<px4::params::ASPD_STALL>) _airspeed_stall /**< stall speed*/
)
@@ -545,11 +545,11 @@ void AirspeedModule::select_airspeed_and_publish()
(_number_of_airspeed_sensors > 0 || !_vehicle_land_detected.landed) &&
_valid_airspeed_index != _prev_airspeed_index) {
if (_prev_airspeed_index > 0) {
mavlink_log_critical(&_mavlink_log_pub, "Airspeed sensor failure deteced (%i, %i)", _prev_airspeed_index,
mavlink_log_critical(&_mavlink_log_pub, "Airspeed sensor failure detected (%i, %i)", _prev_airspeed_index,
_valid_airspeed_index);
} else if (_prev_airspeed_index == 0 && _valid_airspeed_index == -1) {
mavlink_log_info(&_mavlink_log_pub, "Airspeed estimation invald");
mavlink_log_info(&_mavlink_log_pub, "Airspeed estimation invalid");
} else if (_prev_airspeed_index == -1 && _valid_airspeed_index == 0) {
mavlink_log_info(&_mavlink_log_pub, "Airspeed estimation valid");
@@ -74,7 +74,7 @@ PARAM_DEFINE_INT32(ASPD_BETA_GATE, 1);
/**
* Automatic airspeed scale estimation on
*
* Turns the automatic airspeed scale (scale from IAS to CAS/EAS) on or off. It is recommended to fly level
* Turns the automatic airspeed scale (scale from IAS to CAS) on or off. It is recommended to fly level
* altitude while performing the estimation. Set to 1 to start estimation (best when already flying).
* Set to 0 to end scale estimation. The estimated scale is then saved using the ASPD_SCALE parameter.
*
@@ -84,7 +84,7 @@ PARAM_DEFINE_INT32(ASPD_BETA_GATE, 1);
PARAM_DEFINE_INT32(ASPD_SCALE_EST, 0);
/**
* Airspeed scale (scale from IAS to CAS/EAS)
* Airspeed scale (scale from IAS to CAS)
*
* Scale can either be entered manually, or estimated in-flight by setting ASPD_SCALE_EST to 1.
*
@@ -137,7 +137,7 @@ PARAM_DEFINE_INT32(ASPD_FALLBACK_GW, 0);
*
* This specifies the minimum airspeed test ratio required to trigger a failsafe. Larger values make the check less sensitive,
* smaller values make it more sensitive. Start with a value of 1.0 when tuning. When tas_test_ratio is > 1.0 it indicates the
* inconsistency between predicted and measured airspeed is large enough to cause the navigation EKF to reject airspeed measurements.
* inconsistency between predicted and measured airspeed is large enough to cause the wind EKF to reject airspeed measurements.
* The time required to detect a fault when the threshold is exceeded depends on the size of the exceedance and is controlled by the ASPD_FS_INTEG parameter.
*
* @min 0.5
@@ -170,19 +170,20 @@ PARAM_DEFINE_FLOAT(ASPD_FS_INTEG, -1.0f);
* @min 1
* @max 10
*/
PARAM_DEFINE_INT32(ASPD_FS_T1, 3);
PARAM_DEFINE_INT32(ASPD_FS_T_STOP, 2);
/**
* Airspeed failsafe start delay
*
* Delay before switching back to using airspeed sensor if checks indicate sensor is good.
* Set to a negative value to disable the re-enabling in flight.
*
* @unit s
* @group Airspeed Validator
* @min 10
* @min -1
* @max 1000
*/
PARAM_DEFINE_INT32(ASPD_FS_T2, 100);
PARAM_DEFINE_INT32(ASPD_FS_T_START, -1);
/**
* Airspeed fault detection stall airspeed