Oscillation while hovering at certain height with flow, sonar, no GPS

Hello,
I am setting up a quadcopter with sonar and flow in LPE.
I am using the latest version with snapdragon flight controller.
My flow is set up by my own with 30Hz with sonar of up to 5 meters.
My problem is that when my copter is at under 2 meters, it is hovering perfectly.
However, at about 3 or higher, it started to oscillate more and more.
Then I take a look at the code of flow in LPE.
I wonder if why they used it to correct velocity, since it magnifies the error after divided by dt, such a small time interval.
I remembered that it used to use accumulated position to correct x and y.
In that logic, my copter could hover in a higher altitude.
so Why not use position or use both position and velocity to correct the states.
Or any other reason for my oscillation?
Thanks all.

1 Like

Can you share a log?

The above is a typical data from a flight.
flow_measure_vel are the NED velocity calculated by flow in flow.cpp in LPE sensors folder.
lpe_pub_vx and lpe_pub_vy are the two outputs from LPE after fusing flow data.
tof is the sonar value, which is proved to be very accurate.
The flow variance is set to 0.1.
Not very sure about the model used in flow.cpp to calculate the variance of flow. Does it fit for any devices?
Thank you for any comment.