Hereflow was not use to estimate Altitude

I set up the parameters of my Hereflow as
Optical Flow Sensors (landingpage) — Copter documentation (ardupilot.org)
and now the data from hereflow seems to have been used because if I Obstacle avoidance function, the FCU will prompt “PreArm: Proximity: 0 deg, 15cm”, which indicates it consider the floor as an obstacle.
But I have no output from the sonar range topic, and my Altitude keeps drifting.(from 0 to - 1.2m)
Thank you!

My copter: EDU450
Firmware: ArduCopter V4.0.7 (0bb18a15)

Can you try to modify the parameter RNGFNDx_ORIENT?
https://ardupilot.org/copter/docs/parameters.html#rngfnd1-orient-rangefinder-orientation

I try to change RNGFNDx_ORIENT from 0(Forward) to 24(Down) and PRX_TYPE from 4 to 0, now I get sona range output
But my altitude keeps drifting, do I need to do further settings for using sona range to estimate altitude?

I assume you have set the parameters properly?
https://docs.cubepilot.org/user-guides/flow-senor/here-flow#settings

You can connect the cube to mission planner, check Tuning box at the bottom of map, check rangefinderx and see if the value is correct.

Yes, value of rangefinder1 and sona range are both correct
But the altitude keep drifting.
Just like this:

My question is whether EKF can estimate the altitude with data of rangefinde1,if so, what should I set?

If you have set the parameters correctly, the answer should be yes.

The purpose of lidar is to maintain altitude. Unless it is operating under these situations as mentioned

However, it is NOT suitable for height detection in outdoor conditions above 0.5 m, nor is it suitable for indoor height estimations higher than 2 m

You may extract the flight log and see if the EKF is accepting the lidar altitude.

Our copter is exactly flying indoor under 2m, that is why I want to estimate altitude through lidar on Hereflow
I change EK2_ALT_SOURCE from 0 (baro) to 1 (rangefinder), but I am not sure whether the lidar data have been used since there is still a big gap between Altitude
and sona range.


Is there any way to confirm that?
Here is my log:
logs/2021-9-8-rangefinder of HereFlow.bin at main · JC-hub/logs (github.com)

I don’t see there is any big gap


All of the altitude estimations are pretty close.

Also note that Stabilize mode don’t have auto altitude control
https://ardupilot.org/copter/docs/flight-modes.html#overview

I see.
But why in the tuning box Altitude is not close to sonar range?

That’s because the system doesn’t use single source of data to determine its altitude. It fuses multiple sensors to estimate its height.
https://ardupilot.org/copter/docs/common-understanding-altitude.html#estimated-and-target-alt
So sonarrange is more like raw data and altitude is the final output.

Oh, I see.
Thanks for your reply!