Optical flow + gps usage on copter

Hello,

I would like to setup my quad to fly outdoors and use the gps + optical flow for loiter mode.
Is there a way I could setup to fuse the optical flow & gps such that:

  1. It fuses optical flow & gps for position hold, when closer to the ground optical flow has more weight, when higher than the range finder distance, gps contributes more.
  2. The rangefinder + baro are used for height estimation, once beyond the rangefinder’s limit, only the baro is used.

This is so that when in loiter, horizontal movements when closer to the ground are minimal.
I am aware of the LUA script, however, my FC does not contain a sd card (only an external flash).

I do not intend on flying indoors.
I believe EK3_SRC_OPTIONS needs to be set to 1?
Could someone guide me with the settings for the EK3_SRC settings itself?

Currently, my quad is set to switch between the optical flow & GPS based on a tx switch as mentioned in the docs

Also, if the EK3 source select switch is set & fusing was enabled, would it override to allow me to manually switch sources?

Thank you.

The Copter docs page on EKF sources describes an option to fuse all sources of velocity. Setting the first bit of EK3_SRC_OPTIONS makes the EKF take velocity from the XY and Z sources defined by EK3_SRCx_VELXY and EK3_SRCx_VELZ, where x is 1 to 3. The page also warns that the velocity measurements you feed in must be in the same reference frame. So your guess about EK3_SRC_OPTIONS matches what that page describes. I didn’t find anything there about how the EKF weights GPS against optical flow depending on height, so I can’t confirm it gives the blend you want. I would test it carefully before relying on it.