The EK3_SRCx_POSZ should almost never be set to 2 (rangefinder). As the docs say, it is better to keep it at 1 (baro).
This question comes up quite a bit and I guess the confusing thing is that the EKF needs a rangefinder for the optical flow to work but it doesn’t need to use that rangefinder for altitude estimation. The two features, “altitude estimation” and “distance required for optical flow scaling” are separate.
Thanks Randy - I’m working on a project for indoor drone operation. I was thinking that using a rangefinder might be preferable in that situation - but of course that would require no obstacles on the floor.
For outdoor operation that might be less of a problem - but only within the limits of the rangefinder’s range capabilities.
I wonder what the intended use of setting EK3_SRCx_POSZ to “rangefinder” might be?
For outdoor use we definitely recommend against using a rangefinder for the altitude estimate. If there are issues with the barometer it’s better to use GPS. If GPS can’t be used then the baro is the best choice. Users very often think that for terrain following or surface tracking they need to configure the EKF to use the rangefinder but this comes from a misunderstanding of the line between the EKF (used for estimation) and control systems. Terrain following and surface tracking are control features.. not estimation features.
For indoor use with no ground clutter the rangefinder is OK to use for altitude estimation although there are some known issues with it that we are trying to address. Rangefinder is good indoors if the air pressure is variable normally due to air conditioners turning on/off. .. but for really good indoor flight a 3D camera is required including those offered by ModalAI.