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

Importantly, my tree incident did not necessarily involve 2k 2k loops, and was almost surely 2k 4k loops. I was trying to fix spiking by lowering CPU load. Changing 4k gyro to 2k gyro was probably the reason for my current problem…too high PIDS. The straw that broke the camel’s back. If I had realized this last night, I would have set 2k 4k. The rig is drying out and I’ll see what sensor damage if any. Luckily, I went with a waterpoof housing for lightware LC/20.

So, it was finally a nice day and I got some testing done.

First I did some short flights to test at which loop rates my CPU would stop struggling. SCHED_LOOP_RATE=400 and FSTRATE_DIV=4 → 1kHz loop seemed fine. I did have BRD_IDLE_STATS set to 1 for all flights, including the later autotune flights.

After that I did a couple autotunes continuously increasing the loop rates. Only with a loop rate of 200Hz and a fast rate of 4kHz did the error reoccur. This time I disarmed fast so the drone just fell on the soft field before flying somewhere worse.
I also tested it with the fast rate disabled and wasn’t able to reproduce the bug there either.
Finally I used the 200Hz loop rate and 4kHz fast rate again, but this time with a lighter battery and autotune less aggressive. I was able to reproduce the error and managed to save the drone from crashing by switching into stabilise mode fast enough.
I have uploaded all the logs to my drive again TestFlights_19_05_2026 - Google Drive. I have added a short description file listing each log and what happened in it. Parameter changes between logs are shown there as well. The parameters and the ones autotune found are also uploaded.

### Log 7

- `SCHED_LOOP_RATE = 400`
- `FSTRATE_DIV = 4` → 1 kHz

Successful autotune flight, no apparent errors.


### Log 9

- `SCHED_LOOP_RATE = 400`
- `FSTRATE_DIV = 2` → 2 kHz

Successful autotune flight, no apparent errors.


### Log 10

- `SCHED_LOOP_RATE = 200`
- `FSTRATE_DIV = 2` → 2 kHz

Successful autotune flight, no apparent errors.


### Log 12

- `SCHED_LOOP_RATE = 200`
- `FSTRATE_DIV = 1` → 4 kHz

Autotune + crash. 
Switched from LiIon to fresh LiPo for this flight.


### Log 16

- `SCHED_LOOP_RATE = 400`
- `FSTRATE_ENABLE = 0` (no fast rate)

Successful autotune flight, no apparent errors.


### Log 17

- `SCHED_LOOP_RATE = 800`
- `FSTRATE_ENABLE = 0` (no fast rate)

Successful autotune flight, no apparent errors. 
Fairly good tune.


### Log 18

- `SCHED_LOOP_RATE = 200`
- `FSTRATE_DIV = 1` → 4 kHz

Autotune flight — error occurred but no crash
(managed to save it with switch to stabilise)
Lighter battery and autotune less aggressive.

I hope these logs help to find the issue. It does seem interesting that the error only happens with the 4kHz fast rate. If any other logs I may have are interesting or if I should do some other tests please let me know.
Tomorrow my new ESC will arrive. Once that’s installed I can check whether I get the same problems.

Planning to re-attempt tuning my affected copter this weekend, after lowering pids 50%, and was curious what the current theories might be and if there is anything the devs would like me to test such as a particular FM.

Hi @RobinIJ,

BTW, we’ve fixed the pre-takeoff CPU checks in AP4.8.0 and we hope that this means that the dangerous configuration you’ve found will be caught before takeoff.

No pressure but would you be able to load 4.8.0-dev (aka latest) on your vehicle, setup the configuration below (from your testing) and see if it stops the vehicle from taking off? 4.8 is a long way off so ideally I’d like to know if we’ve resolved the issue while it’s still fresh in our minds

- `SCHED_LOOP_RATE = 200`
- `FSTRATE_DIV = 1` → 4 kHz

Txs again!

Hi @rmackay9,
I was able to quickly do the tests today. I upgraded to 4.8.0-dev (b175c3a3) and enabled fast rates with

SCHED_LOOP_RATE = 200
FSTRATE_DIV = 1 → 4 kHz
FSTRATE_ENABLE = 2 (and also tested = 3)

I was still able to arm in both cases.
Possibly important:

  • My arming checks only disable gps and logging I believe.
  • I replaced the ESC already but was not able to really fly yet. Its an AM32 Sequre Blueson A2 70A now

I enabled LOG_DISARMED and uploaded the logs here: TestArming-4.8-dev - Google Drive
The logs show at boot: Rate CPU normal, rate set to 4027Hz

Did this fairly quickly today, so let me know if I’ve missed anything or set it up wrong.

Hi @RobinIJ,

Great, thanks very much for doing the test. So we likely haven’t resolved the problem, perhaps because the CPU load increases after takeoff and not before so we can’t actually catch it then.

Not the result I was hoping for but it’s better to know now. Txs!

It won’t prevent you from arming - it should prevent you from taking off. Are you able to raise the throttle?

Yes I hovered a few centimetres of my floor for a couple seconds

Wait, you need BRD_IDLE_STATS enabled - do you?

Also yes BRD_IDLE_STATS=1 for both logs. I have it enabled since you mentioned it initially

So so try setting (probably props off for safety) INS_GYRO_RATE = 3 to see if you can provoke it.

I did the suggested test today and got some quite odd behaviour.
Test 1:

SCHED_LOOP_RATE=200
INS_GYRO_RATE=3 -> 8kHz
FSTRATE_ENABLE=1 -> Enabled-Dynamic

I was able to arm, and raise the throttle as well.

Test 2:

SCHED_LOOP_RATE=200
INS_GYRO_RATE=3 -> 8kHz
FSTRATE_ENABLE=2 -> Enabled-FixedWhenArmed

When I armed, the flight controller became way to overwhelmed. It did not even respond to me disarming !!! The motors kept spinning up. Thankfully I had no props on, as you suggested. At some point I must have gotten some RC link back and the copter saw that the channel was low and disarmed.
You can see that here:

I uploaded both logs to the same drive folder again. They are 2026_06_14_Test1 and Test2

I think the bug has not been fixed @rmackay9 - I will take a look this week if I have time, but it looks like the check is not kicking in.

@RobinIJ if you set TKOFF_RPM_MIN what happens?

I’m following along and just want to point out the following as it might relate. As I recall someone from the dev conference mentioning during the fast rates talk, tuning a copter with the rates fixed, say at 4k, will result in a poorly tuned copter when the fast rates are automatically scaled down, say to 2k, due to high cpu, without a corresponding decreasing of the pids (which I do not think happens in the code), and might be responsible for my experience. I had just begun experimenting with FSrate setting 3.

In my case, I was using setting 3 to get a high pid tune. I might have then changed to setting 2 for perceived safety, but pids were too high when the rate loop throttled 4k–>2k.[1]

Edit 1: 2k→ less than 2k. Gyro was running 4k, FSdiv 2, cpu throttling enabled.


  1. Footnotes ↩︎

My new approach will be to autotune on setting 2, to allow cpu throttling to keep the tune more reasonable and capable of handling transient rate loop conditions, if and when they develop during AT, and then move to setting 3 for perceived safety after tuning is complete.

@andyp1per I was able to do more tests this evening.

With TKOFF_RPM_MIN=32767 (i.e. too high to reach) the motors did not spin up when I raised the throttle. I tested this for the 4k and 8k fast loop with:

SCHED_LOOP_RATE=400 - higher this time
INS_GYRO_RATE=2, 3 -> 4kHz, 8kHz
FSTRATE_ENABLE=2 -> Enabled-FixedWhenArmed

I (with the help of Claude) started reading the source code, as I was curious why you suggested this, and found the Copter::takeoff_check(). I added a simple log message in there that logs the avg_load and peak_load values.

The 4k fast loop survives this with an avg load ~82% and peak load ~90%.

I was, however, not able to get this log message out of any of the 8k fast rate loop tests. The board seems hopelessly overwhelmed and the logging blacks out, as described in my previous message.

I also added a log message to Copter::rate_controller_thread() within the 10 Hz logging block (the same place RTDT is written). I was able to capture a brief armed window running the 8k fast rate loop: LoopHz fell from 400 to ~260, RunSlow climbed past 13000, and both avg_load and peak_load read 0.

I discovered a rookie mistake in my build that might have been responsible for my experience. Missing prop adapters. Upon entering AT on maiden flight, I’m chalking up my experience to shifting prop balance.

@MaxBuzz @rmackay9 I think I found where the absurdly high PID values are coming from. It is ATC_THR_G_BOOST in combination with the fast rate loop.

I (with the help of Claude) went through the logs from my last post and the source code.

update_throttle_gain_boost() is called at the start of every AC_AttitudeControl_Multi::rate_controller_run_dt(). When the throttle slew rate is above the threshold it multiplies the PD scale by 1 + ATC_THR_G_BOOST and the angle P scale by (1 + ATC_THR_G_BOOST)². These scales are only reset once per main loop in rate_controller_target_reset().
Without fast rate that is one multiplication per reset. With fast rate the rate controller runs several times per main loop, so the boost multiplies up to 1.4^n (n being the number of rate controller runs between two resets)

I have ATC_THR_G_BOOST = 0.4. The maximum ATSC.PDScX in each log is exactly a power of 1.4:

Log Fast rate / loop rate max ATSC.PDScX
16 off / 400 Hz 1.4 1.4¹
17 off / 800 Hz 1.4 1.4¹
7 1 kHz / 400 Hz 2.744 1.4³
9 2 kHz / 400 Hz 14.76 1.4⁸
10 2 kHz / 200 Hz 40.50 1.4¹¹
12 4 kHz / 200 Hz 8820 1.4²⁷
18 4 kHz / 200 Hz 17287 1.4²⁹

4 kHz / 200 Hz would be 20 runs per main loop. The higher values (27, 29) are probably from main loops that took longer than 5 ms (ANG.Dt goes up to ~10 ms).

The logged PID P and D values include this scale, which is where the spikes come from.

The multiplier is by far the largest in the two flights where the problem occurred (logs 12 and 18).

The logic is the same in 4.7.0-beta3, 4.7.1 and master.

Hi @RobinIJ,

Thanks very much for the detailed investigation and report. I’ve added it to our 4.7 issues list so it will be discussed at tomorrow’s dev call and hopefully we can get someone to look at it soon.

FYI @andyp1per