Bad EKF alt with Teraranger EVO 60m

Dear all,

we are using the Teraranger EVO 60m as rangefinder to control altitude with Pixhawk 1 and Arducopter 3.6.0. The sensor works outdoor and we measured with Mission Planner 5 meters as maximum range during some test flights. After that we set:
EKF2_RNG_USE_HGT=70%
EKF2_ACT_SOURCE=0
RNGFND_MIN_CM=50
RNGFND_MAX_CM=600
and we made two hovering flights in guided up to 4m and then 5m

The first flight went well but during the second and after few minutes, we got EKF error (terrain) and CTUN.Alt became negative causing the copter going upwards until our pilot switched in alt_hold and the copter came down even if the throttle was uncontrollable.

We upload the bin in order to show the issue.

Many thanks for helping us,
Regards
Stefano

Sorry…here is the bin file:

It sounds like EK2_ALT_Source is set to 1 (lidar) can you check? Also, in looking into EK2_RNG_USE_HGT the wiki states this is only for use when the primary alt source is set to zero, (lidar) EK2_RNG_USE_HGT: Range finder switch height percentage

From the wiki: EK2_RNG_USE_HGT:
Range finder can be used as the primary height source when below this percentage of its maximum range (see RNGFND_MAX_CM).

Set to -1 when EK2_ALT_SOURCE is not set to range finder.

This is not for terrain following.

Dear Hquarter,

we are sure EK2_ALT_Source=0 and EK2_RNG_USE_HGT=70% of RNGFND_MAX_CM=600 so everything is as indicated on wiki.

The issue happened over 4.2m (0.7*6m) and when the rangefinder blocked at 5.3m.

It seems that, nevertheless the parameter settings suggested by wiki, rangefinder is still considered in the EKF even when out of the maximum percentage and that causes ekf fault.

You can verify looking at the bin.

Thanks a lot
Regards
Stefano