Crash during AutoTune - uncommanded pitch movement during roll tuning - ArduCopter 4.7.0-beta3

Hardware

FC: MatekH743-bdshot
Frame: Chimera V2 7.5" quadcopter, Frame Type: QUAD X BF Reversed
Motors: iFlight XING-E Pro 2806.5 (1800KV) using 4s batteries
ESCs: Mamba F55 4-in-1 ESC (55A), DShot600 with telemetry
ArduCopter 4.7.0-beta3

What happened

During an autotune flight I first noticed odd movements on pitch during roll tuning. The drone was able to recover those and continue. Then during pitch tuning the drone rolled left drastically and crashed full speed into the tree next to it.
I have tried to analyse the logs myself but would appreciate some help and advice.

Details

I set up this drone a while ago. The filters are configured and it was tuned with autotune then (Notably on a 4.7-dev build - possibly not the best idea). I upgraded to 4.7.0-beta3 now and wanted to use the fast rate feature. I’ve set this up and did a test flight which looked fine. Then I went on to autotuning. I did have FSTRATE set to ā€œEnabled dynamicā€ and not ā€œfixed when armedā€ but I did not see a loop rate changed message during the flight.

What I found in the logs

The initial pitch movements during roll tuning can be seen between 16:53:46.000 and 16:53:54.000.

  1. The movements where not commanded by the FC or stick input.

  2. Motor 3 (back-left, BF X reversed) seems to spin on lower RPM than the other motors. This is observable in the autotune log but here’s a screenshot of the RPMs from a later flight. Additionally the current readings from the esc seem quite odd to me as well. So I suspect there may be something wrong with the esc. Either faulty data or real data and a faulty esc or motor.

  3. I did not find any errors with the AHRS. All data seems to be correct and agree.

Later flights

I replaced the broken props and tried again the next day. I reduced the aggressiveness and fixed the faster loop rate when armed. I did see movements on the wrong axis again but it was able to correct those and I got a tune.

Questions

Can anyone help me explain what caused this movement on the pitch axis during the roll movement and later vice versa?

Could the RPM deficit on M3 cause cross-axis coupling during the large autotune roll step and could that be the cause?

Does the data point to a broken ESC or motor, and should I replace it?

Logs

I have uploaded three logs. The main one is the AutotuneCrashLog. Additionally, there’s a hover flight right before that autotune and I have added a flight with the working tune from the next day as well. I presume looking at motor rpm not just for the autotune log may be useful.

Let me guess, you followed the Rosser tuning guide? It’s usually easy to see due to some bad configuration. That’s as far as I got.

1 Like

No I didn’t. Followed a couple different tutorials. This one for tuning mostly ArduCopter 7" Long-Range Standard Build

But what are you referring to exactly with ā€˜bad configuration’

We usually only see RPM parameters for ESC Telemetry configured from pilots that followed the mistake prone guides from Rosser.

1 Like

I found the post about the Rosser guide issues and set RPM1_TYPE = 0 (List of Issues, misinfo and other errors with the Chris Rosser ArduPilot Tuning and Setup Guides). Do you think that misconfiguration is related to the uncommanded pitch movement, or is that a separate issue still worth investigating?

No I don’t think so. It’s just a misconfiguration of the notch filter parameters. He’s got other problems too so when I see the RPM parameters ā€œtellā€ I usually just stop there.

1 Like

If you want to follow an ArduPilot official guide here is the AMC one

My initial setup followed the AMC guide. After that I picked up bits from other tutorials to refine things further. So it’s possible I misconfigured something along the way. That said, the drone has been flying well overall and I don’t think configuration alone explains what I’m seeing. So I’d like to rule out hardware before redoing the whole setup.
Could anyone take a look at the logs and give a second opinion on the ESC data or suggest tests I could run to narrow this down?

I observed something really peculiar in the crash log.

Right before things went to hell, PIDs on roll and pitch, in P and D, spiked to insanely high values.

I guess this should never happen, this is remarkably similar to division by near-zero, and should probably be investigated further by people like @andyp1per. It might be fastrate-related.

UPD: I have seen some of these in the same log earlier, which did not lead to the crash immediately, so I have no idea how serious or normal this is. I have never seen anything like this in my logs, including those with fast rates though.

1 Like

Did you just followed the AMC guide, or did you use the AMC software to follow the AMC guide and validate your parameter changes?

Hi @RobinIJ,

Thanks for the report.

It looks to me like a failure (or partial failure) of the back-right ESC or motor. The reason that I think this is:

  1. Sudden separation of the desired roll and pitch vs actual roll and pitch
  2. The vehicle pitches back (ATT.Pitch becomes negative) and rolls right (ATT.Roll becomes positive) which is towards motor 1 (this is a Quad X BetaFlight style)
  3. Motor 1 (back right) and #3 (back left) go high while motors #2 (front right) and #4 (front left) go low but this doesn’t stop the vehicle rolling towards the back motors

This is the classic sign of a motor or ESC failure although I can’t say that I have a huge amount of confidence in this diagnosis because the incident is very short and it appears there is a twitch in the opposite direction a moment later.

I’ve added this to the 4.7 issues list so it will receive some attention from the likes of @andyp1per and @Leonardthall

As a follow-up at the end of the log when it crashes, it is an uncommanded roll left and pitch forward towards motor 4 (forward left). In the RCOU motor outputs we see motor 4 go high and the opposite motor 1 go low. This again indicates an ESC or motor failure.

Motor outputs, motor 4 goes high, opposite motor 1 goes low

So I think it’s definitely motor/ESC related but it’s probably not as simple as failed hardware. Maybe a signalling issue or ESC configuration? .. or maybe the ESCs just can’t handle the stress that autotune puts on them?

From a 4.7 issue tracking point of view it would be good to know if these issues are also present in 4.6 and whether they only happen when fast rates are enabled.

1 Like

Although you have set SCHED_LOOP_RATE to 200, I suspect you are going to struggle with gyros at 4KHz and attitude loop at 4Khz. Only on a very few builds have I been able to make this work. I suggest you set FSTRATE_DIV to 2 and BRD_ENABLE_STATS to 1. This should give you a warning if your CPU is overloaded and significantly reduce your CPU load.

Can this be the cause of astronomically high P and D term contributions which I spotted earlier?

Hmmn, no that is definitely strange and would not be caused by CPU overload - more likely a bug that CPU overload makes more likely to occur. For instance I can imagine a situation where dt gets really small because the rate thread is unable to keep up and then the maths in the rate controller starts going weird.

1 Like

Thank you all for looking into this problem and in particular @rmackay9 for the detailed log analysis.

I’ll check if I can reproduce the problem without fast rates on 4.7 and on 4.6 in general. Are there any parameter compatibility issues I should be aware of when switching between these versions?

I’ve also noticed that I was pushing the loop rates a bit much. I’ll reduce them as suggested and test this as well.

Once I have results on the current hardware I’ll swap the ESC as well, just to rule it out and see if anything changes.

1 Like

Hi @RobinIJ,

Great, thanks for that. Being able to reproduce the problem would be a great help.

BTW @tridge and Claude produced this autotest that reproduces the issue. No idea whether it is correct or not

I just signed up for an account to say that I had this happen about 2 weeks ago with an AOS 10ā€ ā€˜small high-powered copter’ using FSRATE. It is grounded for now, after it flew sideways into a tree (thankfully it didn’t keep going) during the beginning of the pitch AT phase. I have been a frequent reader but plan to contribute going forward. Can someone describe to me how I can confirm that the ā€˜AT fix is in’ before I update firmware and re-try autotune on this copter? I don’t want to downgrade because I’m also in need of Andy Piper’s baro / rangefinder adjustments…same question, how do I go about knowing when those fixes are incorporated into the ā€˜latest’ dev builds, surely not when they become ā€˜commits’, correct? Any advice would be much appreciated, so that I can keep on top of the latest changes.

1 Like

…additionally:

Matek Slim H743 running standard main loop, 4k gyro, 2k PID loop. I have many other copters with this FC/loop rate setup without issue, but on older firmwares. I’m sure that I saw some spikes in the logs prior to the final flight. NLon 150 ish. CPU always below 600/1000.

My theory had been that AT was causing voltage spikes, so I ordered some premium capacitors. However, given that Tridge + Claude can reproduce in SITL, it is probably not my capacitance, if my line of thinking is correct.