Distance sensor as only source of altitude

We are looking to fly a fixed wing craft close to the ground (~2ft high, within 1-2 inches), so one distance sensor is all we need to provide an accurate altitude data. How may we disable barometer and other estimator, so that the data from the distance sensor is used as the only source of altitude? Would this be in the ekf2 module?

Also, would PX4 correct errors in altitude smaller than an inch, in altitude mode?

Take a look at the parameter EKF2_HGT_MODE:
Determines the primary source of height data used by the EKF

Comment: The range sensor option should only be used when for operation over a flat surface as the local NED origin will move up and down with ground level.


  • 0: Barometric pressure
  • 1: GPS
  • 2: Range sensor
  • 3: Vision

Reboot required: true

Taken from https://dev.px4.io/v1.9.0/en/advanced/parameter_reference.html

This should help you I think :wink:

Thank you for your reply. This is the first thing I tried, but although the distance sensor is getting a reading, the altitude did not change with it. The Pixhawk board was stationary though, so is it a sensor fusion problem?

Also, would there be an issue flying over wavy water?

Can you share abit more information on your setup? What is your rangefinder and how it’s install? What is the wingspan of your aircraft? What is your cruise speed? What type of terrain you are flying over?

For the fusion of the range finder make sure all the EKF2_RNG_* params are correctly set
for your setup and your use case.

For the fusion of the baro data their is two param directly related to the ground effect:


after that you can tune these param to modify how much or how little the EKF use the baro data:


What each parameter influence the importance the barometer in the EKF ?
My question is : if we increase the gate/noise of a sensor (gps, barometer, range finder), the EKF use more or little the sensor data ?