Crash after AutoTune is completed

Hi,

I have 4 kg platform where I have previously done successful AUTOTUNE. I recently decided to change the Motor and ESC and attempted AUTOTUNE. Result of that was around double the P gain from previous motor and ESC. I was suspicious but still decided to fly with those gains, but vehicle crashed sometime after take off.

I would like to know:
Whether this is caused by ESC desync as mentioned in many other similar problems? If yes, why it crashed after auotune and not during autotune?

Any help in getting proper direction is very useful for me to better understand AUTOTUNE process to avoid such problem in future.

Platform Detail:
Config: Quad
AUW: 4 kg
Prop: 16"
Motor: T-motor AG 380KV
ESC: CastleCreations DMR 30/40

DataFlash Log: https://docs.zoho.com/file/bo3d3f6f1308982a44b98921b967a3defb1e2

Your altitude looks suspicious to me:

It thinks it’s on the ground but from the crash you can see that there is another 7m to go. Baro alt is about right. Typically this might be caused by bad GPS or vibes, but I’m struggling to see that that is the case.

First up I see you’re on ArduCopter V3.6.7 with Cube black.
SB02 mandates minimum 3.6.11 with these parameters:

EK2_IMU_MASK,7 <- you have this at 3
INS_USE,1
INS_USE2,1
INS_USE3,1 <- you have this at 0

Please also ensure Mission Planner is updated, as it will alert you to a Cube hardware issue if it exists in your Cube.

Seriously I’d recommend upgrading to 4.0.2, there’s a motor desyncing fix that will help with larger props, although I cant remember if 3.6.7 was affected.

Looking at the log, it just seemed to get out of control and not able to stabilize itself, possibly due to being a bit over-weight or underpowered - average PWM is a little bit on the high side but not the worst we’ve ever seen. The correct settings in MOT_BAT_VOLT_MAX and MOT_BAT_VOLT_MIN could help. Also try these lower PIDs to begin with:
ATC_RAT_RLL_P,0.12
ATC_RAT_RLL_I,0.12
ATC_RAT_RLL_D,0.005
ATC_RAT_PIT_P,0.10
ATC_RAT_PIT_I,0.10
ATC_RAT_PIT_D,0.004

If you’re staying with a AC 3.6 version, start with these parameters then run an Autotune, assuming 6 cells and 16inch props:
ACRO_YAW_P,2.40
ATC_ACCEL_P_MAX,70300.00
ATC_ACCEL_R_MAX,70300.00
ATC_ACCEL_Y_MAX,21600.00
ATC_RAT_PIT_FILT,14.00
ATC_RAT_RLL_FILT,14.00
ATC_RAT_YAW_FILT,2.00
ATC_THR_MIX_MAN,0.10
AUTOTUNE_AGGR,0.05
BATT_ARM_VOLT,22.10
BATT_CRT_VOLT,21.00
BATT_LOW_VOLT,21.60
INS_ACCEL_FILTER,20.00
INS_ACCEL_FILTER,20.00
INS_GYRO_FILTER,28.00
INS_GYRO_FILTER,28.00
MOT_BAT_VOLT_MAX,25.20
MOT_BAT_VOLT_MIN,19.80
MOT_THST_EXPO,0.71
MOT_THST_HOVER,0.20

Initial Parameters if you want to upgrade to 4.0.2 first:
ACRO_YAW_P,2.40
ATC_ACCEL_P_MAX,70300
ATC_ACCEL_R_MAX,70300
ATC_ACCEL_Y_MAX,21600
ATC_RAT_PIT_FILTD,14.00
ATC_RAT_PIT_FILTE,0.00
ATC_RAT_PIT_FILTT,14.00
ATC_RAT_RLL_FILTD,14.00
ATC_RAT_RLL_FILTE,0.00
ATC_RAT_RLL_FILTT,14.00
ATC_RAT_YAW_FILTD,0.00
ATC_RAT_YAW_FILTE,2.00
ATC_RAT_YAW_FILTT,14.00
ATC_THR_MIX_MAN,0.10
AUTOTUNE_AGGR,0.05
BATT_ARM_VOLT,22.10
BATT_CRT_VOLT,21.00
BATT_LOW_VOLT,21.60
INS_ACCEL_FILTER,20.00
INS_GYRO_FILTER,28.00
MOT_BAT_CURR_MAX,50.00
MOT_BAT_VOLT_MAX,25.20
MOT_BAT_VOLT_MIN,19.80
MOT_THST_EXPO,0.71
MOT_THST_HOVER,0.20

You can copy and paste these straight into an ordinary text file (notepad) and Save As with a .param file extension and then apply them using mission planner. This saves trying to find all the parameters and individually type in new values, and possibly making mistakes.

Oh, I also meant to say: Definitely run the Compass/Motor calibration before flying too:

https://ardupilot.org/copter/docs/common-compass-setup-advanced.html#compassmot-compensation-for-interference-from-the-power-wires-escs-and-motors

Thank you Shawn for details.

I wish to understand how this ATC_RAT_PIT_FILT and ATC_RAT_RLL_FILT are affecting AutoTune process?

Also, do initial gains affect the final AutoTune gain? I thought it is independent of initial gains

You’d have to search around on this site a bit and also read through the tuning guide in detail. Maybe pose a question under a suitable heading. Sorry I cant really answer that for you. The whole attitude control, motor mixer and autotune are very complex beasts, and there’s probably not going to be one simple answer. It could be a lecture…

In this video Leonard starts off with the basics, but please watch the whole lot. He does touch on filters. You can look through the code too.

You could be right. I have a feeling you’d be better off starting with lower PIDs and letting Autotune increase them, rather than the other way around.
I suggested lower PIDs because it seemed like you craft was just unable to maintain stability. You’d have to do some hover tests and so forth as sugested in the tuning guide to make sure your craft is reasonably stable and flying OK before starting an autotune.

If the RC is twitchy try this too:
ATC_INPUT_TC,0.22 (or even 0.3 or more for a large heavy craft)

Really, I think you’ll need to try all those things as a whole, get the craft flying pretty well, examine some logs, and then start Autotune over again.