Height estimation and tilt correction problem

Hello.
I bought TFmini rangefinder in order to use it as height sensor for alignment maneuver for automatic landing of an autogyro using fixed-wing controllers. My aim is to estimate height over ground using implemented EKF2 estimator. My primary distance sensor is barometer and I turned on the range_aid function by setting EKF2_RNG_AID=1 parameter. I would like to add, that all test weren’t conducted in flight but on ground. In firmware I set parameters in_air=true.

When it comes to changing just the distance to ground everything is OK.

Problem shows when I hold flight computer in constant height over ground and I change tilt of flight computer(with rangefinder) shown in this log. I thought, that I will observe a bit noisy constant function(dist_bottom). Unfortunately dist_bottom in my opinion doesn’t correspond to real height.
So I looked into code and noticed that fusion is called here. Here is important state variable which in my opinion is related to lpos.z variable used for dist_bottom computation. Is this simplified procedure correct?
Now I want to ask, where is implemented tilt compensation? I could not find it in EKF2 estimator code. According to this line, should I implement tilt correction by myself or use this library module in EKF2? In this module I see tilt compensation.
My another question is about suitable platforms for range aid. I think that this parameter EKF2_RNG_A_VMAX and it’s allowed range is suitable mostly for MC, not planes.

Thanks for your time, answers and patience reading it.

1 Like