Pmw3901 Optical flow sensor not working with latest master

So far I have been testing position hold using pmw3901 with firmware branch stable on both pixhawk and crazyflie board and worked just fine.

In an attempt to improve stability, decided to move on to master version of Firmware and apply same modifications.

I had to modify some code in ekf2 interface to work with pmw3901 driver as here

I had to change this because pmw3901 has no gyro in it.

Checked pmw3901, distance sensor drivers are working.
In nsh, ekf2 has valid local position estimation
In QGC analyzer, local position is plotted.

Problem is, whenever I switch to position hold mode, the drone drift a lot and never stay on position.
Here is the log.

1 Like

I found ecl has been changed since the last commit here

in src/lib/ecl/EKF/common.h
flowSample has member Vector2f flowRadXYcomp

And this variable is updated in estimator_interface.cpp when new flow data is given

But in the latest master I found this variable is moved to src/lib/ecl/EKF/ekf.h

And it looks like flow rate compensation is done in control.h as shown here

Why flow rad compensation has changed and how to modify pwm3901 can work again?