I think today turned out to be the most interesting day of flying I've had for a while...
A friend owns a quad that is largely made up of recycled parts from an old 3dr quad I used to fly (standard motors, standard ESCs, APM2560, MB1200 sonar, 3DR telemetry, H-frame, AC 2.9.1b
We haven't had this particular quad for long and were having trouble with throttle mid-point setting in relation to the auto modes, so we decided to do a bit of testing.
The first part of the flight was uneventful and most things went to plan. The fun really started after I'd done the tests I wanted to do and decided to take the quad higher. I'd been hovering at around 60m altitude and started the descent (in STABILIZE). The quad became almost unresponsive to control inputs in roll and pitch and it was more sheer luck than anything else that we got it down in one piece. (If you want to go straight to the fun part, you can skip to 17:28:10 in the TLOG.) When you see the indicated rolling and pitching in the TLOG, you can take my word for it that the quad was actually almost perfectly level.
It turns out we had a gyro failure. The gyro was indicating roll of up to around 40deg. and minor fluctuations in pitch.
When we were trying to establish the cause of this behavior, we found that the gyros would sometimes fail to initialise properly on the CLI LEVEL command. The message was "gyro failed to converge - error xxx.xxxx DPS".
DPS stands for Degrees Per Second.
Since I wouldn't accept that we simply had a faulty gyro, we spent the next 5 hours or so trying to get to the root of our problem. It turns out that the SONAR sensor on the quad was interfering with gyro initialization causing a divergence over time as the quad was in the air...
I know this sounds improbable, but we were able to repeatedly influence the raw gyro output by moving the sonar sensor
around the frame and the problems disappear altogether when you unplug the sonar.
BE VERY CAREFUL WHERE AND HOW YOU MOUNT YOUR SONAR. Ours was mounted in a way that looked like it couldn't conceivably cause any trouble, Our wiring was all deconflicted etc,,,
I have attached the Tlog and the flash log for the event but you may find that the flash log isn't graphing properly.
It also turns out that the Mission Planner does not warn of a failed gyro init on arming or leveling, unless you do it in CLI. If any of the devs are reading this, it may be a great thing to implement.