Pmw3901 Optical flow sensor not working with latest master

#1

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.
https://logs.px4.io/plot_app?log=8bd954fd-aa9e-4557-a991-d72b92070814

1 Like
#2

I found ecl has been changed since the last commit here https://github.com/PX4/Firmware/commit/6c02cc53deec917b58b4728cdf20b0f99d5a3848

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?
Thanks,

Kyu