Rangefinder as main altitude measurment

I’m using a rangefinder with my Pixhawk 4 with the latest stable version of arduplane installed. I am wondering how to get ardupilot to use this data as its altitude measurement. This states that the rangefinder measurement is only used during landings. Could I force the Pixhawk into somehow thinking it is always landing while still maintaining normal control? Is there a different way to force it to use my rangefinder data?

Update to 4.3 dev from today

1 Like

@Samir_Stevenson can you explain your use case some more? Using rangefinder as primary altitude source is almost always a very bad idea.
If what you want is terrain following then you should use the existing terrain following feature

Ill try that and let you know if it works

Im working on making a hydrofoil boat, and plan on using the pixhawk in rangefinder mode to track the surface of the water. I want the hydrofoil boat to maintain a constant altitude above the water using the rangefinder.

I still cant get it to work. Here are my params
Param.param (16.4 KB)

EDIT: I have kept EK2_ALT_SOURCE at 1 and changed EK2_RNG_USE_HGT to -1

You need to be using EKF3 not 2

I have tried that with EK3_SRC1_POSZ = 2, EK3_SRC2_POSZ = 0 and EK3_SRC3_POSZ = 0

Did you disabled EK2 and enabled EK3 and rebooted?

Yes. Altitude reading still is not connected to the rangefinder measurements in any way

Then you need to find the original pull request from trudge to read the instructions on how to use it.

Okay do you know where I could find that?

I’m considering using someone else’s edited ardupilot firmware but I’m not sure how to upload this do you have anywhere you can point me to figure it out?

You need to Search GitHub and read the ArduCopter documentation

Looking at the code and comments in ardupilot/ArduPlane/altitude.cpp (and elsewhere under ArduPlane) it looks like ArduPlane only uses rangefinder for landing with regular (not quadplane) aircraft.

Yeah. I found an edited version of ardupilot that should work. I’m working on getting it downloaded onto my pixhawk now.

For my own curiosity, which version are you using?

This one