[FIXED!] Copter pitches back, EKF goes crazy, crash detection (motor off midflight!) CRAZY!

Hi all.

I have two airframes (classic, simmetric quads, one 4kgs and another 8kgs AUW) which i’m tuning with a PixHawk 2.1 “the cube”.

All flights done in “Stabilized” flight mode

First, good news: the smaller one (4kg) has been straightforward. A couple of batteries which took me to raise P and D from defaults (3.5.7 stable) to about 0.18 and 0.076 respectively. Took it to extreme manouvers at max angle, no problem.

Then the bigger one: it’s taking me crazy. Same setup (pixhawk 2.1, etc), i had a brief maiden flight with defaults, just to be aware they had to be raised, then put P at 0.2. Then problems began: he wants to pitch BACK to me after take off (in Stabilized) more and more until i cannot compensate with pitch up anymore.
Everything happens in seconds after take off. MP console shows EKF errors exploding.
In one attemp, it switched back to DCM in flight, after i released pitch a bit and it went back by itself, and after switching to DCM it began to fly “correctly” (straight, with normal correction inputs), but showing an error status (various color blinking led) and red EKF on the console. I landed immediately.

Then, In another attemp, same situation, the pitch back situation just after take off (which i was compensating manually with opposite pitch input) has gone to TURNING OFF MOTORS midflight and a crash detection after seconds! Luckly i was low and had minor damages.

Now i’m very puzzled. I will try to put a thick sticky foam to prevent vibration problems, but i don’t think it’s the cause. I don’t know what to do next.

PS: swapped FC with another one, brand new. Had the exact same situation.
Tried also 3.6-DEV, it acted same, i went back to 3.5.7 stable.

logs of last flight with final crash:

https://drive.google.com/file/d/1UgY4GrZThQHcwGf2Nn_hS5X4-RkKavxo/view?usp=sharing

EDIT: FIXED! See the last post

As always, this was an valid crash detection , because the desired and actual attitude were unable to get glose for seconds…

You can start off by resetting your PID’s to something sane :slight_smile:
ATC_ANG_PIT_P ATC_ANG_RLL_P are 0,088 - it is not strange that you have problems with that.
defaults are 4.5 …

Also: do not think you have any use for PID’s from one copter to another, it’s not something you can just copy unless the aircraft are very much alike.

Thanks Andre for insights.

Yesterday i put back default values for attitude pid and did another flight, did not resolve problem:

https://drive.google.com/open?id=1EMUsv5cZVJMA105spjGUlXfizgFrzf38

I know i can’t copy same values of another quad, but i think problem is somewhere not in the PIDs. I have the impression it has corrupted data from sensors. Compass is crazy before even taking off.
The other quad, which is very similar, does not have any of this problems.

Doing new flight tests in a hour or so.

update: pitch back was due to unbalanced frame. Now, centered, i can fly for 20-30 seconds without wind, but “drifting”, sluggish behaviour is still there. I’m trying to put PX4 fw just to make sure it’s a HW problem, i expect to have same problems. Then i will rebuild it from scratch.

update: more flights, more puzzles

tried to swap fcs between small and big quad (no params touched), and had the big one flying fairly well, apart pid tuning. No EKF problems.

Then put back FCs and copied params from small to big. Again, i had a couple of OK flights. I tought i found the problem: some parameter gone wild. Then i started to tune PIDs, raising them a little, ending to an EKF crazyness in a couple of flights. Erased session, put back my saved, “good” parameters coming from the little one, and… EKF errors all the way.

This thing is mocking me, it’s clear :smiley:

Apart rebuilding the thing, i have no further plans.

updated logs of today’s flights:

https://drive.google.com/open?id=1X2HL4_oQKw3akPGAWALCJF2mnotEHg3e

XSteve,

Have you tried resetting to default parameters, getting it in the air with that and then running autotune (potentially several times.

I don‘t have any facts to back this but more a hunch - you are switching your FC between drones assuming „it should work“ but maybe that‘s a wrong assumption… I‘d try starting 100% from scratch, step by step as per docu… has never failed me so far…

i tried autotune, and t simply does not work. it lowers pid. they need to be raised.
swapping FCs that should work is not only an assumption, it worked. frames are very similar and fly ok with same parameters. the big one has some ok flights before problems. Problems means a barely controllable drone and ekf exploding just after taking off and some very mild pitch/roll inputs. Tried to reset everything more than once: one time i can go back to a flyable quad, then i tried again and… ekf exploding. After that, i’m more convinced there’s an HW issue, maybe escs (t-motor flame 80A on the big one)

Tried to rebuild a second big quad (a clone of the first, same frame & hw), flashed a brand new pix2.1 w/ 3.5.7.
Could have a flight without EKF errors, though there’s something weird about PID (though could be normal, since they are still to be tuned): [P rate and stab are the same for PITCH and ROLL] when i mildly push rolling or pitching (similar to what autotune does) it seems ok, with great stability sharpness and no oscillations but when i push a little bit more, it suddenly goes wobbling to an unrecoverable point, and wobbles more and more until i let sit down on ground lowering throttle.

Note that wobble axis is arm-wise, not aligned to pitch or roll, rather 45° to them! Also, it seemed (to my eyes, must verify again) that forward-left motor (motor D or number 3) goes down for an instant when pitching, triggering wobbles, like it’s less powered than the right one. I’ve done ESC calibration procedure and gear (motors, escs) is brand new.

Now, i’m doing some other tests: I’ve suspect big one’s ESC are involved or raise some problems which small one doesn’t have or can “absorb” maybe because they’re faster or have newer firmware/design.
Big escs are tmotors 80A which are out since 5 years. Smaller are Hobbywing Xrotors 40A, much more recent product.
So, i’m putting the Xrotors (a brand new set) into big one, later today will have a flight with them.
Also i will test the old frame again, side by side to new one.

So, here we are. I fixed the issue. I must admit i’m not exaclty aware what was causing problems yet but for sure i had the following problems:

  • Rebuilt frame from scratch: with the same configuration and params, the newer one felt much more “stable” meaning EKF would blow lesser. Old frame had some electrical issues, for sure. Maybe a wrong ground plane which interferes with PWMs. Maybe a faulty PDB. I could not figure out thus where/what.

  • ESCs: first, i lowered ends from 978-20some to 1020-1980us and redone the calibration manually (not with the MP/FC procedure but connecting a simple rx to escs with a ch1-4 outputting the same as throttle, calibrated to same lowered levels above: it changed from night and day, but still some issues remained. EKF not blowing but very close. Quad recovered from mild manouvers but cannot (wobbled HARD motor-wise) when played a little harder.

Then changed the old Tmotor with newer Xrotors. Again, night & day. Now i can play as hard as i could, no problem, no wobbles, no EKF, no Vibe, nothing but a sharp quad under control, even with costant full-stick manouvers. Perfect!

  • GPS unit: i have the HERE (v1). I read about faulty HW design (compass sensors missing, wrong direction, wrong power supply). I have the MAG4 populated only version. Put a 1K resistor as advised here:
    https://github.com/ArduPilot/ardupilot/issues/6633
    As it would fix the power supply issue. Then did a proper Mag calibration, outdoor, with no keys and cell phone in my pockets. It went ok at second attemp. Offsets seems ok. Loiter Ok. Auto missions OK.

It took a month of hard work and lost 10 yrs of my life :slight_smile: but i’ve earned a lot of experience on tuning and finding out HW problems. Thanks to whom helped here.