Short version: if you’re as obsessive as I am, then the Invensense IMU’s may be flawed.
Longer versions: I followed up my duff data errors theory by adding a tiny bit of code that checked whether the Z-axis accelerometer reading was negative; that’s only possible if the quad is upside-down and powering itself towards the ground:
[WARNING] (MainThread) __init__ 1382, Zoe is flying.
[WARNING] (MainThread) __init__ 312, SRD:, 2
[WARNING] (MainThread) __init__ 411, IMU core temp: 23.261427
[WARNING] (MainThread) fly 1507, fly = True, flight plan = fp.csv, calibrate_0g = 0, hover_target = 380, shoot_video = False, vvp_gain = 400.000000, vvi_gain = 200.000000, vvd_gain= 0.000000, hvp_gain = 1.500000, hvi_gain = 0.100000, hvd_gain = 0.000000, prp_gain = 110.000000, pri_gain = 11.000000, prd_gain = 0.000000, rrp_gain = 90.000000, rri_gain = 9.000000, rrd_gain = 0.000000, yrp_gain = 80.000000, yri_gain = 8.000000, yrd_gain = 0.000000, test_case = 0, rtf_period = 1.500000, tau = 5.000000, diagnostics = False
[WARNING] (MainThread) load0gCalibration 536, 0g Offsets:, 0.000000, 0.000000, 0.000000
[WARNING] (MainThread) fly 1646, pitch -1.679818, roll -2.179765
[WARNING] (MainThread) fly 1647, egx 0.000000, egy 0.000000, egz 0.977003
[WARNING] (MainThread) fly 1724, 0 data errors; 0 i2c errors; 0 2g hits
[CRITICAL] (MainThread) fly 1804, ABORT: Duff Data: -228!
[WARNING] (MainThread) fly 2053, IMU core temp: 22.899000
[WARNING] (MainThread) fly 2054, motion_loops 218
[WARNING] (MainThread) fly 2055, sampling_loops 1127
[WARNING] (MainThread) fly 2057, 1 data errors; 0 i2c errors; 0 2g hits
That’s -228 * 2g / 32768 = 0.014g! No wonder she drifts if that keeps happening.
Yet she wasn’t upside down; the only explanation was that the top byte of the accelerometer Z axis reading had the top bit set meaning it’s a negative value. Most likely is actually the top bit was 0xFF – i.e. duff data of 0xFF80 was read from the FIFO as the Z axis acceleration.
On the basis the sensor might be damaged, I swapped to a brand-new one, never used and never abused or dropped. The second sensor also produced the same result.
There were no signs of I2C errors, and I was using the FIFO, so my first finger of blame points at the MPU-9250 pushing duff data into the FIFO. My only doubt is that this happened consistently for each of the 6+ flights I did, and every time within a second or two of takeoff.
I have some more tests to do before I can point my finger with confidence: I’ll post again when I have more information.