FW land detector: do not check for groundspeed if invalid.

In case the local position speed estimate is not valid, it is assumed to be 0m/s and
thus check always passes.
This commit is contained in:
mahimayoga 2025-01-08 16:50:18 +01:00 committed by Silvan Fuhrer
parent 2625c5211b
commit 18b4b18a75

View File

@ -71,9 +71,13 @@ bool FixedwingLandDetector::_get_landed_state()
} else if (hrt_elapsed_time(&_vehicle_local_position.timestamp) < 1_s) {
// Horizontal velocity complimentary filter.
float val = 0.97f * _velocity_xy_filtered + 0.03f * sqrtf(_vehicle_local_position.vx * _vehicle_local_position.vx +
_vehicle_local_position.vy * _vehicle_local_position.vy);
float val = 0.0f;
if (_vehicle_local_position.v_xy_valid) {
// Horizontal velocity complimentary filter.
val = 0.97f * _velocity_xy_filtered + 0.03f * sqrtf(_vehicle_local_position.vx * _vehicle_local_position.vx +
_vehicle_local_position.vy * _vehicle_local_position.vy);
}
if (PX4_ISFINITE(val)) {
_velocity_xy_filtered = val;