Flyaway in Loiter mode

Hi all! Today I was flying my quad in Althold mode and then I decided to switch to Loiter mode and it leaned forward at high speed and I was forced to switch back to althold mode again to avoid disaster.
I tried many times to switch back again to loiter but every time the drone leaned forward and I don´t know the reason for this.

I am providing here the log so if anyone could find the reason for this behaviour I would be very happy. I already looked at many parameters in the log but I can’t find any problem.

KP Index is 5 today, not good to fly in GPS related flightmodes!

There is no functioning GPS on this quad. I can see GPS1 in the messages but it never gets a lock. You won’t be able to maintain position in loiter without a GPS or setting up some kind of position information like optical flow.

I have optical flow enabled so it holds position well. In fact, I disconnected the battery and connected again and it flew normal again in loiter mode. The problem is that I don´t know what caused the flyaway that time. Some kind of bad position estimate caused by accelerometer??

I’m not an expert on Optical flow, but I wonder if trying the settings in the wiki might produce more reliable results.

I’m no expert either but it doesn’t appear that you have calibrated/scaled it.

It is scaled correctly. The drone always flew fine with optical flow. This symptom only happened tis time and no parameter was changed. The drone just leaned agressively forward each time I engaged loiter mode

Might have something to do with this… but I am not sure. The problem with the wiki settings is that the EKF will not use gps velocity data at all and I don´t know if this is better or worse. At the moment I have fuseallvelocities enabled in order to fuse gps and opflow velocities near the ground

That sounds good if GPS was actually functioning.

GPS is functioning. I just did not give it time to acquire satellites. If gps has no sattelites it will not be used so fuseallvelocities will only fuse opflow. The drone always flew ok besides this time

On my quad if you don’t have the right amount of sats you will default to Stabilize.

When I mean flyaway I mean full tilt 30 degrees forward like the drone was chasing a waypoint! That’s not the behaviour of stabilize or althold. The drone was in loiter mode. The problem is what is causing it flying forward so agressively

After further investigation of the log I found that the estimated velocity north (VN) and east (VE) (northeast) increased dramatically despite the drone being hovering almost standing still in althold. Then when I switched to loiter it leaned forward (southwest) in order to “try to stop” when in fact it was already hovering standing still.

Because it had no satellites available I can only assume this was caused either by the optical flow or accelerometer but I am not sure which. One of these sensors must have provided false estimation. I am leaning torwards the opflow beacuse if it was accelerometer I think I would have problems in althold as well