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
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:
Before you start:
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
STEP TWO – Tuning rate_D
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
Congratulations, your copter should be flying better than it ever has done before.
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
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 of what you are looking for
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)
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.
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.
I have looked at your logs and I have some feedback. This does look like the effect I was talking about but I suspect the real problem was your tuning of roll and pitch. This is the most aggressive tune I have seen so far.
Stab_P = 7.5 (This is massive, I would stick to 4.5 on all Stab P terms)
Rate_P = 0.17 (Large but might be ok)
Rate_I = 0.01 (too small, should be as large as Rate_P or bigger)
Rate_D = 0.004 (good number)
I think you have tuned this to a whisker away from stable and the copter started to oscillate as you descended. The roll and pitch input you gave in the last second seems to be the final straw and it let go.
I would suggest that you leave the Stab_P terms all the same at 4.5. I would also re tune the Rate P term with the Rate I term at 0.1. Then once you have finished tuning Rate P, I would make sure that Rate I is the same size or larger. You may also consider reducing the Rate P by 25% if you are tuning to near unstable.
After tuning I do a number of tests.
1. Full Roll input and let go of the sticks. (No motor oscillation should be heard)
2. Repeat 1 for Pitch and Yaw.
3. Repeat 1 and 2 in fast climb at 3/4 throttle.
4. Fast decent on near zero throttle for 5m followed by full throttle (all at about 30m+)
5. Fast forward flight followed by leveling and applying full yaw (all at about 30m+)
6. Fast shuttle runs with full Roll and Yaw input at each end. (all at.... you get it)
Warning: I break cheap Hobby King props on 6. (my tune lets me fly on half a prop)
During 4 and 5 I expect to get some wobble but nothing scary.
If you can do these things without any problems you probably have a very good tune. With large props you may still have a good tune but not have the power in the motors to cope with the more extreme maneuvers. The large prop problem should be seen in 6 as the copter falling out of turns and maybe bucking.
I am very sorry to see your crash. I hope this helps.
Hello, i read you "looked at raw logs". Can you explain how you do that ?
A friend has a Yaw problem, and i would like to analyze logs to see what is wrong.
On logs, we only have CTUN values that i don't see how to exploit those values to solve bad parameters settings ... ????
Is there a specific type of logs ?
We use APM2 boards.
Thanks by advance.
By default you should have more than CTUN runnig, Are you sure that you are only getting CTUN? ( Ia ssume you know that you can go down a line and the column headings change)
If not, this link lists the extra logs you can turn on in terminal
Hello, i have more datas on logs :
Logs enabled : ATTITUDE_MED GPS PM CTUN NTUN CMD MOTORS.
And on your link i can see the "RAW" type. I suppose it is that value that i need to add to my enable logs.
Thanks a lot, i already have seen see that but didn't remember the RAW type.
So i will add the RAW type and see what i get.
Thanks again for this really helpful post and have good flights for 2013. ;)
I tried the reccomended values and it felt vague, verging on uncontrolable. Strangley when a gentle breeze went through it went bezerk.
I started from scratch on a jig with Daves guide and ended up with even higher rate-P =.23 rate D=.014.
It seems happy outside with these values but havent got round to rate I yet.
I am usind simon Ks ESC.
I had it flying really nice with the smaller props with quite high values.
I think I was having trouble recognising what a high rate P does but when I tried a 'silly' high value .3 the woddle was there, but went at about .25.
If that is where you got to then it should be fine. Don't be afraid to back the numbers off if you still feel you have good control though.
I wouldn't take the Stab_P up though, I would keep all of them set to 4.5.
When should stab_p be touched ?
Good question. I am not really sure to be honest because I haven't had to change it to get very good results.
If you do change it you should keep Roll, Pitch and Yaw Stab_P equal. This is because Stab_P acts in the earth frame and is translated to the body frame for the Rate loops.
This means that your Pitch Stab P will be commanding the Pitch Rate loop and the Yaw Rate Loop if you are rolled over by 45 degrees for example.
Sorry I can't answer this question better!
Its still not flying sweet and I am beginning to wonder about vibration.
When I first set up the quad with 12” props there was loads of shaking and it was difficult to tune. Checked the props on a balance and they all were worse than I had ever seen before and needed heaps sanding off the heavy blade. Supposed to be APC but looked cheap and tatty.
Anyway, the current symptoms of vibration and tuning difficulty are much the same as before except the new props are all perfect. Im not that happy with a 14” prop on a 3mm shaft but they look straight after my crash. There is some tracking error on some of the blades. The prop hub is only about 7mm diameter so its a big ask for the prop to go on perfectly flat.
The top of the motor had 4 threaded holes. I would be much happier mounting a prop driver on those so will try to get some, or make some.
At the start of this thread Dave C says something about balancing the prop and motor together. How?
The only time I really touch stab_p is if it flies well in acro, but it doens't feel right in stab.
If stab_p is too high you will get a slow oscillation after a stick input, if it's too low it will feel a little sluggish returning to level.
The really important ones to get right are the rate params. The lowest stabP ive ever used was 3.8 for a way over powered X8, the highest was 5.5 on a highly tuned, well balanced, stock ardu quad.
I am a hydrologist, although I specialise in hydrodynamics much of the same principles apply.
A few golden rules about props which don’t seem to be common practice in the hobby word;
- Never ever ever ever drill out the centre of a prop to make it fit a specific shaft size, you will never get it accurate enough without seriously expensive machining equipment. This is one of the most important points I can emphasize, not matter how much balancing you do it will not matter if the prop is not exactly centre. To this point don’t buy cheap props, use spaces or put tape/heatshrink to make up the difference in shaft size, get a prop then buy a shaft mount that is exactly the internal diameter (it should be a tight fit) or vice versa.
- When adjusting the balance of a prop you never add/remove material from the blade, always add/take weight from the hub, this is due to the blade having a very specific aerofoil and adding/removing material normally results in turbulence on the surface of the blade which can be much worse than being out of balance (less lift on one side of the prop), to this point you are unlikely to be accurate enough without a computer balancer to get this right anyways but if you are going to use a home balancer such as the common magnetic balancers add weight to the hub. In my opinion if the prop is not balanced when you get it don’t bother using it. There is a reason why some brands of props like Master Airscrew are so much more expensive and you will see the results in how balanced and free from “extra moulding crap” they are. When I put these props in the dynamic balancer at work I am amazed at how close they are to being perfect and my assumptions is they are putting through a cheaper dynamic balancer themselves after moulding.
- Technically it is better to balance a prop on the motor and most decent motors are normally not too bad although they usually get out of balance pretty quick from dirt getting into them from use. You won’t be able to balance the motor with the core in it due to the magnets, they have to be done separately and you also have to hope the shaft hole is perfectly straight and the grub screws holding it in are not warping the alignment all of which is going slightly out in a motor worth less than $40 (making a motor with a shaft alignment that is “true” and a balanced magnet and hub assembly is a true art as even the strength and consistency of the magnet comes into play and cost significant money to achieve due to the tolerances that are needed in manufacturing). Just buy decent motors and they will be close enough.
- The shape of each prop also plays a big role especially in the leading edge. This is a tricky one as it is very hard to check without a very accurate laser to measure it with. The cheap and simple test to make a plaster mould of one of the blades leading edges, then when it is dry you give it the lightest of coatings of a dark spray paint (like one quick pass) so you when you turn the prop round and put the other blade into the mould and push down and add a little vibration you can see the light colour of the plaster mould through the dark paint. If this is not showing the entire length of the blade you know the blade is not the same shape.
Now, in saying all that in most cases it does not matter that much in the hobby world as the vibrations really don’t make that much of a difference, but when we are using sensitive electronics that will be affected by the vibrations unfortunately it does and the less vibrations we have the better.
I do have a question, how big are your motors that are spinning 14” props?
It kinda sounds like you might be loading up your motors too much and as a result they can’t react correctly to the changes being asked of them by the APM meaning it won’t matter what settings you put it if this is the case. If you are spinning such big props and the motors are up to the task I would say you don’t need high stab _p rates. My hexa is serious overpowered and I only need a stab_p of 2.9, at 4.5 it has all sorts of problems and one would assume that this is due to the amount of thrust being produce and the APM not being able to deal with how much change is caused by only a minutiae increase in thrust.