Confusion with LIDAR, EK2_RNG_USE_HGT

How can i tell which height measure is being used? Can i see it in the log somehow?
If i set lidar to measure 17.5m then on what logic is the switch done? Lidar measurement or on baro?
EK2_RNG_USE_HGT in documentation can go from 0-100% but MP shows 70% as max. Is the 70% because on a tilting quad it could othervise go above the max range?

Hi Karl,

No, there is no way to know from a log. I guess this could be useful, but we already log so much from the EKF that I’m not sure we’ll add this.

When you say that you set your lidar to measure 17.5m I’m going to assume that you have set up RNGFND_MAX_CM to 1750. The EK2_RNG_USE_HGT is a percentage of that. For example, if you set it to 50, the EKF will only use the rangefinder when the copter is below 8.75m. There are some constraints to it using rangefinder too: the terrain has to be stable below the copter (if terrain isn’t mainly flat there is no way for the EKF to know if it was the terrain that went up or the copter) and there is a speed limit too (I’m not sure of the value).

Where have you seen 100%? In the wiki it says 70%:

I can’t say for sure why 70% was chosen, but I’d guess it was to reduce the chances that bad readings (which are more probable closer to the limit) go into the EKF.

My max range is set to 25m and 70% is 17.5. This should be fine especially since i only use the lidar for pecision landing. The movement speed is minimal and i should get very consistent readings. Only once out of a hundred landings i saw height doing something funky and i couldnt understand why.

Is there perhaps a general height reading which is what the quad is using for its course correction? I have my own GCS and i would only want to display one height for the quad regardles which sensor is used.

Hi Karl,

Well, yes. I don’t want to explain the code complexities here, but the land mode (and others) use the rangefinder value (directly) to know the altitude above terrain - instead of guessing how high the terrain is compared to home.

If you have any specific issue, making a topic about it might you give more and better answers.