Depth sensors with px4

I am working on a “flying” submarine glider using PX4 for altitude and heading control. To get depth control I was going to turn off the barometer in my IMU (pixhawk 4) and create a custom range finder driver that would work with a high resolution depth sensor. Does this sound like it should work? Other option would be to modify the barometer driver so it reads the depth sensor but I worry that might be harder than it sounds. Thanks in advance for any guidance!

Something like this should work i think, if you use it the same way a downward fasing laser distanse sensor is used for altitude in copter.
(i know that’s ardu, not px4, still usefull i think)

Interesting idea.

Curious how your flying submarine glider project was progressing?
I am interested in having a low cost depth control system for a towed hydrophone array so your flying glider seems like the same concept. We wouldn’t need heading/roll/yaw control, just an actuator to change the control surface pitch angle and a pressure sensor for depth input. Having an echo sounder input for “terrain following” or seabed avoidance as Nando suggested would be a useful additional feature too.