Drone keeps moving left when in position hold mode with optical flow

Hi all,

I have been testing position control using pmw3901 optical flow sensor.
Flight log about local position shows very good position hold however, it keeps moving towards left.
Here is the log.
https://logs.px4.io/plot_app?log=81cb8ced-59ba-4bc2-839b-088ee64b2785

And here is the integral of raw optical flow sensor data.


Above plot is time integration of flow sensor int x and y.
Calculated speed is approximately 0.01 m/s while there is no significant movement in forward/backward direction.

It looks like somewhere in position controller yields small errors is body x frame.
How can I solve this problem? or any suggestions on this issue?

//Added video below

Kyu

So I decided to manually compensate errors in optical flow to local position estimate.
To do that, I need to transform flow int x, y in body frame to NED frame as shown here.

in mc_pos_control_main.cpp
the rotation matrix _R being updated every att update as here

and by subscribing the optical flow orb message, I can get int_x and int_y and put it into
matrix::Vector3f _flow_int;

My question is, in order to transform, simply multiply them would work?

matrix::Vector3f flow_ned = _flow_int * _R;

Hey, have you found any solution for this, yet?