Arducopter Tuning Guide

The arducopter tuning guide.

 

This guide was written at the time of the release of Arducopter 2.8.1 FW. It is a compilation of everything I have gathered from the experts in the field of flight controller tuning. It will help give you an understanding of how to tune any rotor based flight controller, but its specific to Arducopter and this firmware release.

I will update this as necessary, or if you can convince me any of it is incorrect just post below and I’ll update this text.

There is a summary/quick reference at the bottom, so once you’ve read this rather rambling explanation you won’t have to again, other than to check details :D

 

The background

Tuning your flight controller is essential for a perfect flight. Even a fully stock frame will fly better if you tune. The default params will be close, but your battery or motors might be performing differently, your air maybe ‘thinner’ compared to the developer that last published the default params, so you should tune.

What we are trying to achieve is control. We start to accomplish this by modifying the amount of P, I and D in our control loops. All three react to our stick inputs and the errors created by measurements from our sensors, and all three will help us fly better. If we do not have enough of any of the params the copter will not feel like it’s under control, it will wander about, not resist wind and be hard to fly. Too much of any of the params and the copter will seem to have a mind of its own. It will over-react. At best you will see it oscillate, very fast, not so fast or somewhere in between, depending on which parameter has been overclocked. At worst it will simple flip over on take-off or be very unpredictable in flight.

We need to find a balance. You can tune each param up individually, but one will have an effect on another. Therefore we must tune one, then another, then go back and see if we can retune the first one again, this is the balance.

And this is where we adjust those parameters – Mission planner config page:

3690972138?profile=original

 

Before you start:

  1. Charge all of your batteries, you are going to need them.
  2. Check you are using compatible ESC’s, motors etc, some combinations cause problems.
  3. Balance all of your props (in-situ preferably – adding bits of tape or nail varnish to one side of the prop until the motor and prop don’t shake at all under throttle.
  4. Do all the other sensible things like check everything over and calibrate your ESC’s , radio compass etc.
  5. Set your copter up as you will normally be flying it. If you tune it then add or remove weight, or change the CoG, you will have to tune it again. Use your normal flight batteries, a 4s tune will be different to a 3S tune. If you don’t want to risk your expensive camera, just substitute its mass with something less valuable, like a bean bag or kids toy.
  6. Be prepared to have the chopper in your hand if possible and throttled up (so gloves on, maybe a full face motorbike helmet – that sort of thing, this way you be able to tune quickly and accurately. If you simply can’t hold it in your hand, or a simple jig such as you will see in the videos below – i.e. it’s a gas heli copter/ mad octo then you will just have to do it the long way round – in flight. But read this guide anyway it will speed you right up! (PS helis are not currently supported in 2.8.1, watch this space.

 

So let’s start tuning

Everything you read below will be demonstrated in the tuning video further down, so you know what to look for, and at the bottom is a summary for quick reference. I think, however, it’s important to include as much information here as possible as anyone starting into this hobby will often find this process to be a bit of a black art.

I’ve found the quickest way to tune the arducopter is to start with rate_D, (but you simply can’t do this unless you can hold your beast in hand or in a jig as the copter won’t fly without any rate_P or I) so a more universal way to start, and actually a more informative way is to start with rate_P.

Since this is about learning for everyone, let’s do it that way. I’ll give a brief low-down on the ‘rate_D’ tune (or Dave C tune, as it’s become known) ‘ later. (BTW, that’s very flattering but I’m only relaying info from the real experts, but hey, if I’m gonna be famous, why not for doing something I love  :)) Anyway....

 

STEP ONE - Tuning rate_P

  1. Put your copter in ACRO mode,
  2. Turn rate_D and rate_I to ZERO.
  3. Set your stab_P to about ZERO, or if you decide to avoid the jig/hand tune and go for immediate in-flight tune set it to about 3.0 as the code is currently using the stab param in acro mode), a true acro mode would not use the stab_P parameter.
  4. Set a range of rate_P you would like to work with. I’d advise 0.050 or lower to 0.225 the first time you do this as, although you are unlikely to end up near either extreme, you will see what happens at, and beyond, the limits.  You will be able to reduce this range as you become more familiar with tuning.
  5. If you know how to do it, set a pot on your transmitter as channel 6 and use mission planner to set your limits, if you have telemetry this is a joy, if not you are going to be plugging and unplugging your usb quite a bit, it’s not that bad though, and defo worth it.
  6. OK, time to go, hold copter in hand above head, or place in jig. Throttle up to about hovering point. Wiggle your roll and pitch sticks. With rate_P about 0.075 (unless you have a monster powerful chopper) it will react slowly to your sticks, it will feel relaxed, lazy. If you tried to fly this you’d be chasing it about with your sticks, you’d probably crash if it was nose in, if you know what I mean.
  7. Slowly turn up rate_P with your pot, or in MP. Move the copter about with your hand and with the sticks as you do so, raise the throttle a bit, lower it a bit, add in more rate_P. It will start to feel and look much tighter in the air, throttle right up and flick your stick the copter should move fast, decisively but then stop quickly and smoothly. If it seems lazy you need more rate_P, if it starts to bounce when you move the sticks or tip the copter about then you have past your limit at this point.  Get to a point where you are happy, it feels tight but does not shake.
  8. Save this rate_P, value, our aim is now to increase it using another parameter – rate_D so on to step two

 

STEP TWO – Tuning rate_D

  1. You have found a nice rate_P value (or so you think), so leave that fixed for now. For example 0.110
  2. Set a range of rate_D from 0.000 to 0.025.
  3. Throttle up in hand with rate_D at 0.000, things should be as you left them at the end of step one.
  4. Now start turning up rate_D, again move the sticks, shake the beast about, you will notice that at a fairly precise point you start to see very fast oscillations. This is your maximum rate_D, I’d set it just under where you can induce these fast oscillations by moving the sticks fast of shaking a leg.
  5. Now you can go back to rate_P and tune that again, you should be able to increase it considerably!!! So to step three.

 

NOTE: once you have found your rate_D you can try something interesting - you will have to hold onto your bird for this obviously. Set rate_P to zero, then crank up your rate_D as you just have. You will discover that these fast oscillations occur at pretty much the same level of rate_D, no matter what you have set rate_P to. This is why I think it’s more than possible to start tuning rate_D then move on to P. But that’s a shortcut, and this is not what this guide is all about.

 

STEP THREE – Tuning rate_P even more

  1. You have your maximum rate_D set, now try increasing rate_P again.
  2. You should be able to add at least 30%, maybe more before you get the oscillations. It will react faster to stick movement, be difficult to move with your hand and just feel very solid in the air.

 

Congratulations, your copter should be flying better than it ever has done before.

 

STEP FOUR

  1. Using your ‘happy’ rate_P and rate_D values, start tuning rate_I. This is better done in-flight and will feature in part two of this guide. Basically just keep tuning it up until you notice a loss of ‘feel’. It will hold an angle better for you, unless it’s too high then things go sluggish and eventually oscillate slowly.

 

 

STEP FIVE - HEAD OUTSIDE!!!

 

For now set Stab_P  at 3.0 - 3.5, closer to 3.0 if you have a high power machine, just to get you flying in stab mode. Then spend your time tuning rate_I and stab_P.

 

If you find your set up immediately too harsh, back off on rate_P and rate_D by 10% each, and try a lower i-term, if it's still too harsh do that again!

 

All that’s left is to watch the video below so you can see what I’m describing and head outside for fine tuning. Oh, and await part two of the guide and amendments from any discussions raised, then we will have a proper tuning guide that will be integrated into the wiki advanced tuning guide  :D

Results for tuning in this video were

 

Rate_P 0.168

Rate_I  0.654

Rate_D 0.008

 

 

Oh and as promised, below is Part One of the Summary Guide. I aim this to be on one sheet of A4 and tell you everything you need know ‘in the field’.

Summary Guide

  1. Tune up just rate_P
  2. Tune up rate_D
  3. Tune up rate_P more
  4. Tune rate_I as best you can
  5. Take it outside with a stab_p of 3.0ish and tune rate_I and stab_p in flight, to your liking, maybe adjusting the other params too slightly, to get it just as you want it.

 

Summary of what you are looking for

RATE-P

Too much rate P will oscillate quickly, and cause to copter to sound angry under stick input, bouncing rather than smoothly following your inputs. It will also shake more at full throttle and under hard turning.

Not enough you will not feel like you have full control. It will feel sloppy and be very easy to over correct with your inputs. It will feel delayed.

Perfect is where it feels locked in, stiff in the air, but not shaky. (although if I’m sport flying I turn it up a bit for maximum ‘wang’ and just tolerate the slight oscillations)

RATE_I

Too much rate_I will oscillate if you get high enough (a much slower oscillation than a rate_P shake). But quite a long while before it oscillates it will have other detrimental effects on flight performance, like a sluggish feeling or a tendancy to flip over on take-off. This is why I suggest tuning this in flight rather than in your hand/jig.

Not enough will cause the copter to get pushed by a constant wind, then it will fight back using just P. It will not hold a very firm angle during forward flight and will need more correction. This will not be as smooth as it could be in either case.

The perfect amount will cause the copter to lean gracefully into a constant wind, but also allow you to set a lean angle and stay there as you fly about. As you dial rate_i in pay close attention to the feel of the copter, you are not looking to create oscillations here at all, you should notice a strange ‘feel’ long before this point.

 

RATE_D

Too much rate_D will oscillate very fast, you will see a twitch forming then a fast buzzing oscillation

Not enough rate_D will simply mean you can’t dial enough rate_P and so you will suffer the effects of having rate_P too low.

A perfect rate_D will help fight the wind and follow your sticks as its fast to react, but will also allow you to reach a maximum rate_P level for you frame, thus giving better control.

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Can someone suggest the parameter to change so the throttle stick position is about the same in Stabilize as in Loiter?

    After updating to the latest firmware, when I go to Loiter from Stabilize the quad takes off rather quickly up.  In Stabilize the throttle stick needs to be about mid point to hold an altitude about 5 meters.  The stick needs to be only about 10% up to get Loiter to that altitude.  This makes transitioning between modes problematic.

    Second question, since I didn't save the parameters before I updated the firmware, is there any way to recover them from old flight logs?  Loiter also jitters around a great deal now while Stabilize flies well.  It would seem if I could recover those previous values I might just set the current parms to those and regain Loiter stability.

  • Nice tuning weather here so I've been out on the field and emptied about 6 lipo's.

    I've been tuning the loiter and RTL parameters.

    Loiter is fine but sometimes it twitches a little and then starts off in a toilet bowl spin (sometimes quite violently)

    The next time I switch to Loiter it is very calm.


    For the RTL part...
    This is working but if I'm about 30m for the home position and I switch to RTL it very quikly picks up speed, overshoot a little, slams into the brakes (heavy tilting) and goed into toilet bowl.

    When I engage the RTL from a closer distance it works well.

    Auto landing is working as well.

    When it is in a smooth RTL, it loiters for about 5sec, slowly descends and after a couple of minor hops it settles down.


    Any thoughts on what to verify?
    Here are my parameter settings (TBS like frame, 1100KV motors, 900gr weight)

    3692694692?profile=originalThanks

  • Open pilot will have AUTOTUNE VERY SOON(it is in beta) why cant we have the same???

    http://wiki.openpilot.org/display/Doc/Autotune+Setup#AutotuneSetup-...

    https://vimeo.com/48808497#

    https://www.youtube.com/watch?v=ofdiwF_fgMQ

  • Hi,

    I've been optimizing my setup in order to reduce the vibrations (accel-Z was very bad).
    Due to this ALT_HOLD was a disaster.


    Now that the accel-Z is within specs (-10 +/-2) my focus now goes to the ALT_HOLD.

    Rate_P and D have been tuned as well.

    I just did a test flight and found that when switching to alt_hold the quad is yo-yo'ing a bit before it levels out.

    This is also visible in the logs.

    3692685337?profile=original

    Around 8600 I switch to alt_hold. The motors start pulsing and dies down around 8900.

    From this moment the quad is solid in the air.
    I guess I need to reduce the Throttle_P (correct me if I'm wrong).

    I've been looking as well to the "throttle in" which is around 57% for hovering in average.

    I think this is quite high as the throttle dead band is already at 60%. This is a very small window to engage the alt_hold.
    I had a few times where the quad was climbing or descending slowly while in alt_hold. Possibly due to being out of the dead band.

    Next to do is:

    1) re-center throttle for hovering (mid stick) --> alter the THR_MID value

    2) lower throttle_P to reduce yo-yo'ing effect.

    Can someone advise if this is the correct procedure and if my analysis is correct.


    Thank you

  • When you write of tuning rate_P, rate_I and rate_D which of the variables are you referring to?  I'm missing something basic as I see multiple of all of these e.g. under Roll, Pitch, Yaw, Loiter, and Throttle.    Sorry for the basic question.

  • Hi all,

    I succeed to tune my Quad and manage to RTL, waypoint and Position Hold without problem.

    But my quad will climb slowly when Loiter and Altitude Hold and never stop climb until I turn it into Stabilize.

    Which parameter that I have to tune more?

    Thanks.

    Waladi

  • Please help me out as I am totally confused and lost at this point. I've read this VERY helpful documentation many times to fully understand PID Tuning and I think I now have a good understanding. However, I cannot get my F450 quad to fly stable indoors when hovering. I've reflashed to  2.9.1b, reset and erased the apm 2.5 and calibrated each ESC. What happens is the quad will randomly move to any direction... so I am constantly using roll/pitch to keep it in one spot, even with using radio trims, it will not stay still.

    When viewing Mission Planner, the horizon isn't very stable and the Roll (deg) is usually in the negatives (-1). Would this be causing the quad to constantly move around when hovering?

    With default settings, its worse. After tuning, these are the settings so far that have seemed to make it a little more stable. P 0.1850 / I 0.500 / D 0.0090.

    Motors: Sunnysky 2216 800kv

    ESC: RCTimer 30A SimonK

    Prop: APC 10x4.7

    3S 3200mah

    Weight: 1560grams

  • Hi, I am translating the document Dave C in French.

    PID Tuning.doc

  • Hi Stephen, You raise some good points, PIDs are seldom understood well even by most engineers let alone those who are not.

    Essentially they are the 3 control parameters of a feedback loop.

    The primary value P is generally the primary (amplitude) input - how much force is being used.

    The other 2 values adjust how it interacts with the results of it's own actions.

    What I have said is generally true for P but the I and D interactions vary in their result on a case by case basis.

    Also, the PIDs in ArduCopter or ArduPlane often interact with each other which makes them even more complex.

    The single PID that is most important to getting the ArduCopter to be flyable is the Rate PID and the P value basically sets it's throttle response.

    The higher the Power to Weight ratio of the copter the lower you want the rate P to be.

    In fact, several attempts have been made in the Wiki to properly describe our PIDs but they all fall short and a serious redo of this Wiki section is really called for.

    Especially with the release of 2.9.2 imminent and which is going to have a considerable affect on ideal PID values due to inertial navigation rather changing the game plan.

    Dave C has by far the best practical method for tuning the most important PID, but we really need to combine his expertise in a much improved Wiki section.

  • Hi Dave, thank you for a great guide!

    I've got some problem with throttle-control after the 2.9.1 Firmware update. 
    I fly a dji f450 frame with simonk esc, rctimer 2830/11 1000kv motors, 8x4,5 carbon-props running on 4s 5000mah batteries.I guess it weights about 1,7kg

    Motors and props are balanced individually and together  The arduino is placed 15mm over the top-plate to avoid any disturbance from the distributionboard.

    I've used vibration dampers between the lunchbox and the frame, and earplugs between the lunchbox and the ardupilot. The raw logs looks pretty good.

    My problems are:

    1) When I used 2.8.1 it flew very well in stabilize mode, it was actually that mode I used most of the time. After the new update the quad won't hold altitude at all in stabilize mode. With the 2.8.1 firmware the quad would more or less hold it's altitude at about 50 percent throttle, with the 2.9.1 firmware the quad just want to climb or descend,it's impossible to hold an altitude. I've tried to turn down the throttle rate P from 6.0 and all the way down to 0,01, I've also tried to change the expo at my T9x.

    2) Altitude hold only work if I just fly the copter over a very small distance. Say if i fly 20+ meters straight ahead, the copter will just descend, and not rise before I release the pitch.

    3) Loiter works very well as long as there is very low wind, but needs some tuning before it will fight the strong winds.


    I assume that I have to sort out the thottle-problem before I can continue tuning altitude hold and loiter. I've tried a little bit, but I feel that i don't get any improvements.

    For all i know, maybe some of you experts immediately see whats wrong o_O.

    Regards

    Eirik

    3692679148?profile=original
    3692679085?profile=original

This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…