Strange flow behaviour or EFK3 switching source/initializing bug

Hello to all,
I have a well tuned Hollybro x500 V2 frame, cube orange, here2 gps, tfmini plus lidar and hereflow.(copter 4.3.3)
I have set a switch in my RC to switch EKF3 source to gps or optical flow.
Today was somehow windy at 3m/s and gusts up to 5m/s
I noticed a strange behaviour
*If I power on with switch at gps source,takeoff at loiter and change to optical flow, all good
*If I power on with the switch at optical flow position and try to take off at loiter, the copter, at about full throtle barely leave the ground for about 40cm and then descents and (hard)land by itself. This happens both at loiter and alt hold mode!
*If I power on with the switch at gps mode, switch to optical flow and then take off, all good again.
This is, I think the log file:

Why I cannot power on,arm and take off with the source switch only to optical flow?
(the drone will be used mainly to gps denial enviroment. I want to remain connected for compass and hardware switch)

Thank you in advance!
Spiros

Hi @Nautics,

Can you post the onboard log again?

Hello, I also encountered similar problems, first of all, if I set the EKF height source as a barometer, there is a height limit to a certain distance can not be raised, in the source code seems to be related to the RNGFND1_MAX_CM parameter, but I try to change different values to raise the height is the same, how can I improve the fixed point height? In addition, when switching GPS and optical flow from different sources, when using EKF2 optical flow source to a height of several meters, the mode will be displayed when switching to land_mode and landing directly. What is the reason?

Hi @angleman,

Optical flow requires a rangefinder so some pilot controlled modes (Loiter, AltHold, etc) will stop climbing when they reach the rangefinder’s maximum altitude because if they climbed any higher this would surely cause an EKF failsafe.

It’s best to use EKF3 because it supports GPS/Non-GPS transitions. EKF2 does not support transitions.

Hope that helps.

Another question I would like to ask is that the optical flow I installed has a ranging module. Why do I set EK3_SRC1_POSZ to 1 and use the barometer as the height source, but the height will rise when I fly from the ground to the table? How can I modify the fixed height

Hi @angleman,

I’m not sure which optical flow sensor is on the vehicle but as far as I know, no optical flow sensors have a rangefinder with sufficient range. They nearly all use really short (e.g. <2m) rangefinders that perform very poorly. This is why on the wiki it says an external rangefinder must be used.

The EK3_SRC1_POSZ should not be set to rangefinder unless the vehicle is being flown indoors in a room with no ground clutter that the vehicle could fly over. E.g. no chairs, tables, etc. In 99% of cases it is best to stick with the barometer as the altitude source.

I do set the barometer as the altitude source, but what I want to know is why does the altitude rise by itself when flying indoors over the table, I want to stay at the same altitude indoors all the time without changing the height of obstacles, how do I set it

Hi @angleman,

Aha. So that is probably because the vehicle is in Loiter mode and Surface tracking is enabled. There’s a SURFTRAK_MODE parameter that can be used to disable it.

althold poshold and loiter all like this

thank you,solve the problem