Range Sensor rather than Barometer

Hi there,

I have a basic question, which I could not find any answer on web. What if I want to use a range finder sensor as the main decider for the altitude? Can I do it? If yes how?

I know it is not a very common thing because of the sensor ranges but I just want my drone to fly at low altitudes and extremely sharp. A barometer is not the way I wanted to follow, because I am working indoor and relaying on altitude mode, which is not that sharp.

Hello @HVK,

Here’s the answer you’re looking for: https://docs.px4.io/v1.9.0/en/advanced_config/tuning_the_ecl_ekf.html#range-finder

Thank you so much. That was the exact thing I was looking for.

Also see https://docs.px4.io/master/en/flying/terrain_following_holding.html

Hi there, I used what you have suggested however I have a small problem.
You see replacing barometer with range sensor as an input to Kalman filter worked for PSTCTL and ALTCTL mode. However, when I passed to the HOLD mode from my RC it just failed and crashed. As a test I send Mavlink commands from my computer with telemetry, then I discovered that at HOLD mode even I enabled the range sensor as input PX4 is still reading and acting by the barometer. I tried to change its position by Mavlink and giving altitude as barometric altitude was the only option. Is there a way to use range finder as the main altitude source for HOLD mode.

@HVK sorry about the crash. Could you share the log of that flight/crash?

@bresch this is not expected, right?

Actually after I upgraded my PX4 version v1.9 to v1.10 it solved. I believe it solved at v1.9 to v1.10 but it might be v1.10 to v1.10.1. I am not perfectly sure. However, now I can fly with range finder at HOLD mode.

I can not share the log file because my PX4 is not taking logs unless I format the SD and install new version. Upgrading on an existing version stops the all logging thing. Most of the time I am not using the logs so I am passing the format SD step.