Initial values for ATC_ANG_xxx_P - I can't find them mentioned in the tuning guide

Working through my understanding of my copter’s tune, I’m searching for how the values of ATC_ANG_RLL_P, ATC_ANG_PIT_P and ATC_ANG_YAW_P are set - and how they might be adjusted.

I can’t find a mention of them in the tuning instructions announced some time ago by @Leonardthall here: Setting the Aircraft Up for Tuning — Copter documentation

In my records, I find that the initial values for each of these was 4.5. Auto Tune has changed the value of these parameters quite dramatically - and inconsistently. Auto Tune has set these to as high as 11 for pitch and roll, and down to about 7. (I have 22" props)

I’m trying to find a reference to help me do sanity checks on these parameters.

Thank you!

The is the angle controller P value. The angle controller can hit limit cycle oscillations just like the rate controller - so too high and you will get oscillation (although tends to be slow oscillation). High angle P values will give you better position control when disturbed (think wind). The default of 4.5 is pretty low - a reasonable value would be 8-10 for a larger vehicle. If autotune gives you anything less than 4.5 then you have a problem with noise on that axis. On my smaller quads I want very high values so the angle control is very accurate - but this is usually too much for larger vehicles.

By the way, I have a situation with few quads, ranging from 2" to 9" propellers, when autotune produces a tuning with ATC_ANG_xxx_P over 30 which:

  • looks really well when hovering;
  • but the quad starts to oscillate at some 10-15 Herz in pitch and/or roll when:
    • hovering very low above the ground;
    • descending somewhat quickly (maybe even at 1 m/s);
    • flying even in a moderate wind.

Could you maybe hint what to look for?

They can be tuned manually in the same way as the P and D term. You get a lower frequency oscillation.

Most people use the autotune results as you don’t need to increase angle P to do a safe autotune.

After tuning I tend to set roll and pitch to which ever ended up lowest. I do the same for the acceleration.

Yaw is normally much lower than roll and pitch.

For a 24 inch prop aircraft or larger, I would say 6 to 8 on roll and pitch, 4 to 6 on yaw.
For a 10 to 24 inch prop aircraft or larger, I would say 6 to 12 on roll and pitch, 4 to 6 on yaw.
For < 10, I would say above 8 on roll and pitch, above 5 on yaw.

Except if you are me :rofl:

32 is definatly above 8 :slight_smile:

Thank you @Leonardthall and @andyp1per for commenting to my recent threads. I really appreciate it.

Regarding the advice on setting ATC_ANG_xxx_P based on prop size - and then allowing AutoTune to improve it:

On several of my Auto Tune flights on a Tarot X4 I got some wildly different results from pitch and roll on these parameters. Knowing that both pitch and roll would have similar setting on symmetrical quad-copter, I guessed that either pitch or roll might be right - but which one?

And as there’s no wiki guidance for setting these parameters initially - when Auto Tune takes the default of 4.5 and cranks it up to 13 - that does make one wonder if maybe Auto Tune’s results were faulty.

Regarding how to validate if the settings are correct - Here are plots of desired and actual pitch and roll at three different values of ATC_ANG_xxx_P. I’ve normalized the plots so each displays 5 seconds. I’ve also made two plots - one where there is a low variation, and one where there is high variation.

Can you please offer advice on determining which of these settings (12, 7.5 and 5.5) might be more correct from these plots?

ATC_ANG_xxx_P = 12

ATC_ANG_xxx_P = 7.5

ATC_ANG_xxx_ANG_P = 5.5

From these plots, as an untrained person in tuning, I’d think the 5.5 (lowest) value produced the best results. But I have no way of knowing this. From observing the copter fly, there’s no visible difference. And for a 960 class quad, the comments above suggest that 12 is the better value.

(And I’ve had Auto Tune runs where one axis was 13 and the other was 5)

With such a vast array of data and analysis tools, it seems to me that there are algorithms that can be followed to optimize tuning - no different than sorting and searching algorithms in computer science.

If you can suggest references, I’d gladly invest time in reading them. If there are not - I’d be happy to write up technical papers on the subject and publish them on my small collection - which can be freely added to the ArduPilot wiki.

Once last thing - so far there are only two physically observable ways I’ve found to determine a good tune: 1) does the copter wobble on the landing descent. 2) Are the motors cool to the touch after a mission.

If there are better things to observe, I’d be grateful to learn about them.

Once again - many thanks for helping!

The default is 4.5 because we are confident that value is good enough to fly safely and is going to be stable on the vast majority of aircraft. It is common for Autotune to increase this value to the values you see in your comparison table.

It looks like you got a good autotune in the table. I would leave them on the higher valuse or set them both to 10.

This is expected because your angle error stays small because of the way the command model works. To test Angle P you need to turn feedforward off.

ATC_RATE_FF_ENAB 0

https://ardupilot.org/copter/docs/evaluating-the-aircraft-tune.html#evaluating-the-aircraft-tune

Looking at the spreadsheet…did autotune generate the values for ATC_RAT_YAW_P & I?

Good question. No - those values are the defaults. I haven’t had Autotune do the yaw axis yet.

I really appreciate your patience in your responses to this thread.

I firmly believe in doing the work to fix any problem I express a grievances about. If those who are knowledgeable about tuning can guide me to learning the facts, I promise to produce documentation so others can benefit from the effort.

The thing about the manual tuning process instructions in the wiki is that they only describe how to achieve basic non-oscillating flight. I can find no information how to go from this point forward to achieve what you might describe as a good tune.

I understand process control and the function of PID gains. But this concept applied to something like a furnace or a boiler is quite different that for a multi-copter. With a furnace, success might simply be achieved by constant temperature of the effluent.

I’ve found nowhere in the wiki that defines what well tuned quad-copter performance looks like - beyond lack of oscillations. As my copters are designed to fly only automated missions, once oscillations in forward flight are removed, the only observable measure of tune I’ve found is oscillations on landing descent and motor temperature on landing.

But if you look at the desired and actual pitch and roll plots - there’s nothing published to describe which plot represents a better tune. We have the luxury of enormous stores of performance data - but no guidance on how to interpret it or improve it.

On my plots above in this thread - all three settings examples are from well behaved flight. If those plots were from different settings of PID gains, how would I know which one is better?

And alas - the PID gains aren’t the end of the story - ATC_ANG_xxx_P and filters and many others come into play. There has to be a systematic way to approach setting these parameters properly.

I understand that the ability to run autotune does not make one an expert in tuning.

I appreciate your efforts in helping us gain such expertise. Thank you!

Usually, in my understanding, ATC_RAT_YAW_I is 10 times smaller than ATC_RAT_YAW_P as a starting point.

So, in this case ATC_RAT_YAW_P = 0.18 would start with ATC_RAT_YAW_I=0.018…so I’m wondering if 0.18 for I is really what you are using?

Thank you for asking for verification.

All the values in the spreadsheet I posted are taken directly from when I saved the parameters to a CSV file from a BIN file - so they are all actual values - no typos. All the yaw values are defaults - I’ve not yet performed an autotune for yaw.

I expect some of the DEV’s might have something to say about these values. I hate to tag one of them on this post out of the blue. Do you know one we might ask?

Thanks you!

If you’ve already flown it without any issues and with these values then it probably is not a major issue and autotune will figure it out.

In the autotune wiki (under ‘if it fails’) it states the ATC_RAT_YAW_I = ATC_RAT_YAW_P * 0.1

https://ardupilot.org/copter/docs/autotune.html

Usually @xfacta and @dkemxr are happy to help out with tuning & log analysis questions.

1 Like

Hi Peter,
You are correct, these are the defaults:

ATC_RAT_YAW_I,0.018
ATC_RAT_YAW_P,0.18

They would normally stay in proportion and it would be typical to see something like these after tuning:

ATC_RAT_YAW_I,0.07
ATC_RAT_YAW_P,0.7

all the way up to 1.1/0.11 or so.

1 Like

Fascinating!

I went back and looked at BIN files of my previous copters, and all had the default values you mention - where “I” is 0.018 and “P” is 0.18.

BUT - on my current copter - my first copter with an Orange+ cube, this is not true. These two values are equal.

And since I haven’t done a yaw axis autotune, these values still remain.

And of course this conflicts with the autotune wiki citation @Clogz noted above.

Could this be a bug in the Orange+ copter firmware? (Orange+ BDshot firmware, to be precise)

Thank you @Clogz for your extraordinary sharp eyes - and for bring it to our attention!

By copy to @xfacta - can you please assist in getting this to the right place to be addressed?

Many Thanks!

1 Like

I don’t see that with a new Orange+ Cube right out of the box I just opened. It’s at the Default .018/.18 values.

FWIW:

If there is a unique parameter change for a board it would be in the defaults.parm file in Hwdef. Nothing in there for PID’s. From what I recall all boards default to these Yaw values unless it’s a custom config for a vehicle.

Did you load the BDshot version?

Yes, wouldn’t load anything else.

On a new cube - so no old parameters are carried forwarded?