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.