Copter: flowhold: correct height estimate calculations

... by accumulating height weights into float rather than uint8_t

these weights are all likely to be very low, so the "ends up at zero" case is likely to always be taken.

 - min_flow_change is 0.04
 - the value is in radians/second

I have an inkling this might originally have been "i" - i.e. accumulate across the three axes and then divide by the number of axes included in delta_height_m - but the code was subsequently changed to be include the abs_weight instead but the type was missed.
This commit is contained in:
Peter Barker
2026-07-15 20:52:11 +10:00
committed by Peter Barker
parent 179ae0ab03
commit b6d7107929
+1 -1
View File
@@ -449,7 +449,7 @@ void ModeFlowHold::update_height_estimate(void)
for each axis update the height estimate
*/
float delta_height_m = 0;
uint8_t total_weight = 0;
float total_weight = 0;
float height_estimate_m = ins_height_m + height_offset_m;
for (uint8_t i=0; i<2; i++) {