Sudden significant yaw, pitch, and roll

During some recent flights on two identical quads (same parts, different build) we saw sudden significant yaw, pitch, and roll, only for the crafts to right themselves and continue during an autonomous mission. Needless to say, it was a stressful experience, especially after having them fly smoothly for so long.

Here’s a graph of the first quad:


(see time 16:55:00)

And the accompanying log: https://drive.google.com/file/d/11IG0Q5rOasJIBulIEhSMqGZRUPxjMdX5/view?usp=sharing

And the second quad:


(see time 10:53:00)

And the accompanying log: https://drive.google.com/file/d/14hgfwPfc5j9373nj-x-IxEZv2VES486-/view?usp=sharing

Can someone tell me why this happened and how to prevent it from happening in the future?

Quad1
It actually does that twice in the flight. The second time is a smaller excursion.


The problem is tuning. The PIDs are too low and there’s a lot more you can do to set this up correctly. It seems somewhat manually tuned.

I see you’ve got the Harmonic Notch filter enabled, do you have a log with the pre-filter data? Or can you do a hover test flight with
INS_LOG_BAT_MASK,1
INS_LOG_BAT_OPT,0
I’m not saying the HNOTCH is a problem at all, just checking if it’s correct, as part of the process.
INS_HNTCH_ATT can be set to 40

I would set these and see if you can get off the ground without too much oscillation (or any at all) and just hover and maybe some gentle movements if it’s going OK.

INS_GYRO_FILTER,23 (just leave all the other filter settings how you have them)
ATC_ACCEL_P_MAX,50500
ATC_ACCEL_R_MAX,50500
ATC_ACCEL_Y_MAX,18000
ATC_ANG_RLL_P,6.0
ATC_ANG_PIT_P,6.0
ATC_ANG_YAW_P,4.0
ATC_RAT_RLL_P,0.1
ATC_RAT_RLL_I,0.1
ATC_RAT_RLL_D,0.00625
ATC_RAT_PIT_P,0.1
ATC_RAT_PIT_I,0.1
ATC_RAT_PIT_D,0.00625
If that goes well and normal flight is possible, I would do Autotune on Pitch and Roll. Yaw can be sorted out later.

Let’s see the log of a test hover to collect the HNOTCH data and with those updated params - and include your thoughts and observations.

Quad2
Same again, there’s always oscillations in pitch and roll that the flight controller is not able to correct with the current tuning. Eventually it gets out of control.


This graph is not even showing the excursions, just mid-flight.

Same parameters as above, but HNOTCH is a little different. I would definitely check and tune HNOTCH for each individual aircraft, but the other ATC params can be used on both as a starting point. In the end you might be able to settle on a standard set of tuning params that works well on both aircraft. I would just test and tune on one aircraft and see how that goes, then MAYBE transfer some of the settings over and retest on the 2nd aircraft.
Ideally you’d autotune individually in case there’s slight differences you haven’t noticed.

Hi @xfacta, you actually have helped me with the tuning previously with these quads here: Tuning a fleet of large quadrotors. Interesting that the PID tune is still the problem… they seem to be very stable and responsive with the current tune.

You can find a log with pre-filter data there, I believe. I can create a new one of course.

Reviewing my notes, the logs in this thread are from quad # 4 and # 1. I may not have updated # 1 all the way with the latest tune and HNOTCH and whatnot.

The last log in that other discussion was showing better attitude control than the logs in this discussion.
The other discussion was getting a bit too confused for me :slight_smile:
See if you can put in the params I suggest here and do a new hover test for the HNOTCH data. Try Stabilize mode first, switch to AltHold if you think there’s no risk of a fly-away.

What ESC’s do you have?
If they are T-Motor Flame ESCs then use these params:
MOT_THST_EXPO,0.2
MOT_PWM_MIN,1100
MOT_PWM_MAX,1940

Compare and put in any params calculated in this spreadsheet when you put in your prop size, except MOT_THST_HOVER which will be correct now.


Download a new copy if you already had it, this one has been recently updated.
And of course these I mentioned before:
ATC_ANG_RLL_P,6.0
ATC_ANG_PIT_P,6.0
ATC_ANG_YAW_P,4.0
ATC_RAT_RLL_P,0.1
ATC_RAT_RLL_I,0.1
ATC_RAT_RLL_D,0.00625
ATC_RAT_PIT_P,0.1
ATC_RAT_PIT_I,0.1
ATC_RAT_PIT_D,0.00625

Make sure all the MOT_SLEW and other params are back to defaults, anything that was being changed for testing in that other discussion.

Stick to using the same aircraft (Quad 1?) for all these tests, then it will be a simple matter to do the same procedure on all of them.

  1. initial params from spreadsheet, hover test to gather HNOTCH data and check/eliminate vibrations
  2. hover test and dynamic flight to verify HNOTCH worked as planned
  3. Autotune

Avoid manual tuning unless you are an expert at that - you’d need a small quad you would be prepared to sacrifice to practice manual tuning. The Tuning guide is the exception to that, where it says to increase and decrease PIDs to achieve usable relatively stable flight.

Ok, I’ll give it a go and focus on one quad for now.

FYI, I am running the Flame 60A ESCs, T-Motor Antigravity MN6007 320KV Motors, and the T-Motor Folding Polymer Propeller - MF2211.

@xfacta, would you mind looking at the last log in Tuning a fleet of large quadrotors, here’s the link to it:

https://drive.google.com/file/d/1NFceSFd_AXjPNd8ATmLump9kgWP5lJS-/view?usp=sharing

Notice that the end was a crash after performing an RTL. Performance during the flight seemed very nice, but of course, the RTL resulted in an out-of-control oscillation. Is there anything I should tweak to avoid this prior to tuning?

It seems a lot of crashes and out-of-control events happen in RTL. I find it’s because battery settings are not correct, combined with some less-than-ideal tuning and the copter easily gets out of control.
And MOT_THST_EXPO might not be correct, leading to instability during descent.
We should test descent rates manually, looking for instability, and adjust LAND_SPEED settings and PILOT_SPEED_DN at least.
I’m not saying those are definite in your case, but the battery settings are odd.

You’ve got:
MOT_BAT_VOLT_MAX,25.2
MOT_BAT_VOLT_MIN,19.7
yet these are:
BATT_LOW_VOLT,18
BATT_CRT_VOLT,16

Leonard Hall explained setting and testing MOT_THST_EXPO

  • set too high you can see instability at low throttle <- this one!
  • set too low you can see instability at high throttle

Those T-Motor Flame settings I mentioned will help a lot.

I’m curious about the T-motor flame settings. MOT_PWM_MIN and MOT_PWM_MAX seem close to the values I use now (defaults to RC3_MIN and RC3_MAX) but MOT_THST_EXPO I set to 0.75 following the autotune directions here: https://ardupilot.org/copter/docs/tuning-process-instructions.html#tuning-process-instructions Why should this be as low as 0.2?

MOT_BAT_VOT_MIN and MAX were set directly from the tuning instructions as well. Are you saying I should match MOT_BAT_VOLT_MIN to BATT_LOW_VOLT?

Reportedly the T-Motor Flame ESC do their own thrust linearization and people have had good success with using 0.2 (or even 0.0) for MOT_THST_EXPO.
However !! there’s also some contradictory information from T-Motor themselves but we suspect they weren’t understanding the question too, and their technical info is practically non-existent. In some of the info for Flame ESCs it says they can’t be calibrated, and then in some of the leaflets (you could NOT call it a manual) it says to calibrate them ??? So go figure…

If the low battery level warning is set at 18 (or critical at 16) then why wouldn’t MOT_BAT_VOLT_MIN be 16?

Download a new copy of this spreadsheet to check your settings

Hi @xfacta,

Finally got out to the field to continue tuning (I was sidetracked by other obligations until now). I changed the PID values to the ones you mentioned, changed the MOT_THST_EXPO to 0.2, the MOT_BAT_VOLT_MIN to 16, and the MOT_PWM_MIN to 1100, and MOT_PWM_MAX to 1940.

ATC_ANG_RLL_P,6.0
ATC_ANG_PIT_P,6.0
ATC_ANG_YAW_P,4.0
ATC_RAT_RLL_P,0.1
ATC_RAT_RLL_I,0.1
ATC_RAT_RLL_D,0.00625
ATC_RAT_PIT_P,0.1
ATC_RAT_PIT_I,0.1
ATC_RAT_PIT_D,0.00625

When I turned on the quad for the first test flight the props spun up without arming! I figure the MOT_PWM_MIN was too high, so I cut power and reverted MOT_PWM_MIN to 0 to use RC3_MIN of around 950.

Ok, attempt #2 - I got her in the air and I noticed immediately the change in MOT_THST_EXPO made for a less-touchy takeoff - which is great!

Test-out log: https://drive.google.com/file/d/1BMT9ByHkzfCbt70wJiqtAp2cygmlNLrD/view?usp=sharing

Next, I put her into an autotune. I added a payload of 400g to get a tune that would handle the payload we’re expecting to be on the quad for the autotune. The autotune was completed successfully, here are the PIDs that it came up with:

ATC_ANG_RLL_P,4.812885
ATC_ANG_PIT_P,4.126447
ATC_ANG_YAW_P,3.216632
ATC_RAT_RLL_P,0.06263047
ATC_RAT_RLL_I,0.06263047
ATC_RAT_RLL_D,0.006483898
ATC_RAT_PIT_P,0.05935019
ATC_RAT_PIT_I,0.05935019
ATC_RAT_PIT_D,0.00825844

Autotune log: https://drive.google.com/file/d/1sgk6enlr7usgcYkNVsQeDvQ4mnFHadcp/view?usp=sharing

I also tested the tune out, and she felt a bit unstable. In fact, I saw some oscillations during a guided flight so I flipped her back into alt-hold and landed her to regroup.

Test logs:
https://drive.google.com/file/d/1THz8kw7uOKhvsdcAnMOtt1z2SqPkoSXP/view?usp=sharing
https://drive.google.com/file/d/19mY6UMc1clh_JNvI4TbNbS_98Q3dkoJV/view?usp=sharing

Here’s the pitch instability that caused me to want to land:

It seems like these PIDs are still off. In fact, the higher starting PIDs seemed to produce a nice notchy flight out of the quad.

What step should I take next?

A D term that is overly high will give the feeling that the quad flies sloppily. Bringing your P term back up toward ‘6’ and watching for P term overshoot / oscillation will help tighten up the feel of the quad.
I really like using auto tune to get sort of a baseline tune for a quad and then begin walking P term and D term up until I get the exact feel I’m looking for.
From my experience, I term is best tuned on a windy day. You can watch for attitude adjustments in FFF, but wind makes tuning I more visible.

I should amend this by stating that as you increase D; keep en eye on your motor temperature and watch the logs for high frequency oscillation. This heat in the motors and a ‘warbling’ sound during attitude correction tells you that your P & D are pretty much at their limit.

Thank you so much @TooSlow2Care for the guidance around manual tuning. It feels like I’ve started down the path of finally dialing in the quads. I was able to manually tune the roll and pitch P and D parameters and brought them up higher than I expected. My current P and D are 0.115 and 0.009 respectively. This is amazing because my original P and D were about 0.05 and 0.005. Here are some plots of expected and actual roll and pitch:

And the test flight for these plots: https://drive.google.com/file/d/19WVY9OKI8kNQF7YreLbAcvPuzzjRkGEV/view?usp=sharing

How does this look?

I guess I am seeing some jagged behavior towards the peak of the movements - I was attributing this to wind at the time. Is there anything I should focus on fine-tuning?

My next step, if the P and D are dialed in is to focus on the I term because I’m seeing some dipping when moving between waypoints

1 Like