After many successful flights copter occassionally veers upon take-off and rolls

@Fusionflight @xfacta,
Copter tries to move sideways upon takeoff randomly (only happened twice in 30 odd flights). Then flips. Both times has been using GPS guidance for vertical take off.
It was running a here3 with firmware ver 1.8.AB157ABD (which I believe is latest) and a secondary dgps for backup gps. I’ve got GPS_AUTO_SWITCH = 4, as I only want to use the dgps if the Here3 shits itself.
You can see in the logs it veers ever so slightly to the right then launches left and does a double barrel roll.
I’ve added a 5 second delay to the board boot, as I was getting some configuration errors on the 2nd GPS occassionally.
Below is a link to download the logs. I’d really appreciate it if I could have some expert eyes across it so I can avoid more crashes trying to figure it out.


Section 1 is where it tries to go right immediately upon throttle up and Section 2 is the start of the barrel roll to the left.

Hi Tim,
I have to ask, because I couldn’t find it anywhere: What is flight mode 127 ?

In relation to the crash
I suspect the flight mode 127 may be negating some important checks or features, because Lat and Long are still drifting before arming, and in this case you are allowed to arm even though Fence is set and Home position is not set. This looks very strange to me.
To try and improve position reliability I would set:
WP_NAVALT_MIN,2 ← In a Auto mode the copter wont try to navigate below this alt, and may even drift with the wind.
And try starting in flight mode Loiter at least until it is armable.

I would also update to latest stable firmware. The new firmware does more of a jump into the air on takeoff to try and avoid this sorts of issues and there’s a parameter to control it

Other general things
I would set these:
INS_LOG_BAT_MASK,3 ← collect some data for the harmonic notch filter setup
MOT_PWM_MAX,2000 ← set to suit your ESCs

And run Autotune if possible.