Rangefinder Configuration Help


Hello all,

I am working with a fixed wing UAV, which will fly with a Pixhawk running PX4. I have at my disposal a Sf11c rangefinder, which I successfully integrated by I2C. Now I need help configuring the PX4 to make use of the “distance_sensor” topic.
According to the documentation I can use one of two options:

Set EKF2_HGT_MODE to Range finder (2)
Set EKF2_RNG_AID to 1

But I don’t know which should I use. I have some doubts.

How does EKF2_HGT_MODE calculate height when distance to the ground is too high for the sensor, or when the sensor fails for some reason? Does it ever fall back to the internal barometer?

EKF2_RNG_AID only applies below EKF2_RNG_A_HMAX (max 10m) and below EKF2_RNG_A_VMAX (max 2m/s). That seems really a small use case, and I think it won’t trigger even in auto landing. Am I wrong? (It seems to be focused for VTOL)

What is the recommended way to use this sensor?


What do you want to achieve with the range sensor? Do you want terrain following? Do you want a more stable altitude hold? Where are you intending to fly the system, indoors, outdoors?


I’m assembling the pixhawk/px4 to fly a 3 meter wide fixed wing UAV called Albatross, outdoors. The lidar came in the kit I have, so mainly I just wanted to make sure I used it correctly. I am also interested in doing automatic takeoff and landing. Can this sensor help with that?


Ok got it. For fixed wing applications I would’t recommend using either range sensor as primary source of ĥeight (EKF2_HGT_MODE = 1) or using range aid. But ekf2 does estimate the terrain height which can be used for fixed wing auto landing. There is actually quite some development activity going on in that area on github.
We probably did the same thing a few years ago, see this video

1 Like

hello,i use range sensor in order to terrain following,how to set up the params. my drone is dji450 ,outdoor