Only using range finder for altitude estimation?

Hi,

I want to only use my range finder to determine the altitude. I have read this page about how EKFs work. It says that in addition, the range finder can be used in the for the EKF estimation. I assume this is done by changing the EK3_srcx_posz parameters. I have changed it so that EK3_src1_posz is 2, i.e. range finder, and the other srcx parameters are set to 0, such that they have no sources. There is also the EK3_rng_use_hgt parameter, for which the description says that “Range finder can be used as the primary height source when below this percentage of its maximum range”. According to that description, I’m assuming that the bigger the value, the more the range finder will be used for altitude estimation, but the value only goes up to 70%?

I’m confused about what is ultimately used for altitude estimation, and if it is possible to only make the software care about the rangefinder values?

That other parameter is for using short range rangefinder during takeoff and landing only when something else is the primary altitude source. The rangefinder must be above EK3_rng_use_hgt of rangefinder range during flight with that option in use.

So it is irrelevant for my goals? I should set it to -1?

`EK3_RNG_USE_HGT` is a switch height, not a source selector — you’re right that it isn’t what makes the rangefinder the primary altitude source. It only says “start blending the rangefinder in once the vehicle is below N% of the rangefinder’s max range”, and that behaviour only matters when another source (baro/GPS) is primary. So with `EK3_SRC1_POSZ = 2` you can leave it at −1.

What will bite you with rangefinder-only Z: (1) the measurement is height above whatever the beam hits, so a wall or a vehicle under you becomes your altitude; (2) `RNGFND1_MAX_CM` wider than the module’s real reach lets bad long-range returns into the EKF; (3) you still need GPS or optical flow for X/Y — if you zeroed those sources too, the EKF has lost the aiding it needs to keep the whole solution consistent, and that is usually where “altitude is fine but it drifts” comes from. Also set `RNGFND1_GNDCLEAR` to the real sensor-to-ground height on the bench; a wrong value looks exactly like a constant altitude offset afterwards.

Worked through the parameter set here if it’s useful: ArduPilot laser rangefinder setup — RNGFND, EK3_SRC1_POSZ, EK3_RNG_USE_HGT

Got it, thanks!