From e2f45f49de9101932cc7f2162e490a3addeaec8c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 3 Dec 2022 12:25:31 +1100 Subject: [PATCH] AP_Landing: prevent a landing division by zero if sink rate set to zero --- libraries/AP_Landing/AP_Landing_Slope.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_Landing/AP_Landing_Slope.cpp b/libraries/AP_Landing/AP_Landing_Slope.cpp index 34aedcff3e..d2db6d4cf8 100644 --- a/libraries/AP_Landing/AP_Landing_Slope.cpp +++ b/libraries/AP_Landing/AP_Landing_Slope.cpp @@ -284,7 +284,7 @@ void AP_Landing::type_slope_setup_landing_glide_slope(const Location &prev_WP_lo } // time before landing that we will flare - float flare_time = aim_height / tecs_Controller->get_land_sinkrate(); + float flare_time = aim_height / MAX(tecs_Controller->get_land_sinkrate(), 0.1); // distance to flare is based on ground speed, adjusted as we // get closer. This takes into account the wind