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:

And the second quad:

(see time 10:53:00)

And the accompanying log:

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

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
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)
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.

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:

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:

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:

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:
yet these are:

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: 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.


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:

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:


Autotune log:

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:

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:

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