Indoor position hold becomes toilet bowling as seen below video.
Build is from https://github.com/PX4/Firmware/tree/crazyflie_optflow and pmw3901 sensor used for flow sensor.
I noticed magnetic field around this room is not so good and might affect the performance of ekf2.
Is there a way to make ekf2 more tolerable to poor compass? I am asking because some other reference drones such as hover camer or DJI’s spark flies just fine in the same area.
Above issue can be resolved by increasing update rate of optical flow data.
As I found in below pmw3901 code, raw delta x, y from the sensor are summed until time elapsed from last flow data transmission gets to 45000 or 45 ms however this is too long for ekf2 estimator.
I changed this code to send for every delta x,y update and all of sudden the drone stops toilet bowling.
Also I noticed that PMW3901_SAMPLE_RATE is set to 10000 or 10ms but is not guaranteed by the system.
When measured dt between the measurement, it is not solid and off about 2 to 3 ms and sometimes gets to 10ms delay.
/-----------------------------------Added below
Below plot is time dt of flow data gathered while flying. I clearly shows there are lots of jitter in timing.
If dt becomes more solid, stability would be much improved.
One solution would be changing the main processor but is currently fixed so I have to find other solution now.