Fuse altitude measurements to state estimate

I would like to send altitude data produced by embedded, downward-looking range finders (VL53L1X and teraranger evo 60m) to the auto-pilot. I would like to do it over mavros since I already have interfaced the sensors over ROS on a companion computer.

Should I try to use the /mavros/vision_pose/pose topic? I also heard that the distance_sensor uorb topic could be used (don’t know the mavros equivalent though). There are also several PX4 parameters (EKF2_RNG_* and EKF2_HGT_MODE) that have to be set (defining when to use the range finders, e.g. at takeoff and while landing), but I am not sure if those parameters are supposed to work only with supported flight controller hardware when connecting specific range finders directly to them.

Long story short, I haven’t found a clear way of publishing altitude data over mavros to let the EKF2 fuse this information into the state estimate. Any hint?

I have no idea if what you are trying to achieve is going to work over MAVROS, because the MAVLink interface might be transmitting at a much lower rate that you might need, and even though you could in theory increase the rate, you would be putting extra stress in the system.

I would suggest you switch from MAVROS to using the microRTPS price for ROS, read-up on the docs, you will be able to publish directly to uorb topics