Optical Flow: flow_y and body_y divergence causing EKF error and EKF Loiter rejection

Hi everyone,

I am troubleshooting an issue with my Optical Flow sensor. During flight, I am seeing a significant divergence between flow_y and body_y values, particularly when the copter is moving just before it comes to a stop. This divergence seems to be causing the EKF to reject Loiter mode.

I have a few questions regarding how the EKF handles these values:

  1. Is it reasonable that body_y approaches zero as the copter’s pitch stabilizes, while flow_y continues to report high values because the copter is still moving?
  2. Does the EKF interpret this natural divergence as a sensor fault? Specifically, does the EKF interpret this divergence as a sensor fault simply by comparing flow_y, body_y, and Gyro_y values?
  3. Is it possible that this error is actually stemming from another source, such as compass interference, rather than the flow sensor itself?
    log:

@amilcarlucas
@ppoirier
@jstroup1986