As for tuning PID or so, it's very much a trial and error process. Short story: With auto-level on, swing the copter from side to side with full range like a skate-boarder on a half pipe. When you release the stick and the copter goes back to level, does it wobble as it returns to level? It should not, it should slide into it's level position just like the skateboarder coming down the slope into the middle of the pipe. If there is wobble, then the copter is over-correcting. So go into the PIDs and if the wobble is large then pull the P-term down until the wobble is slight, then pull the I (eye) term down a bit until the wobble goes away.

Let's move our analogy over to sailing a boat. Imagine that you are sailing toward a mark (buoy). On the first attempt you'll probably just point the boat straight for the mark but with a prevailing wind or current you might find that when you get close the mark you ended up far of course. By the way, sailors call the shortest line directly between the start and the mark the "Rhumb line". Sailing the Rhumb line rarely get's you to the mark.

So you go back to the starting line and try again. This time, as would an expert sailor, you take into account the wind direction and current and rather than sail the Rumb line you point upwind while also continually correcting for changing external factors. With practice and experience you reach the mark precisely every time. What is this process you are naturally doing? *It is PID control!*

First, you are observing the direction to the mark as compared to the direction of the boat and determining what the difference is. This is the angle of proportional error (Perror). To correct for this error, you put a certain amount of muscle pressure into moving the rudder. The exact amount of muscle pressure to the amount of proportional error would be the P term! It's like a multiplier that makes your reaction to the proportional error larger or smaller. As you get more experienced at the helm, you get finer muscle control and you get better at knowing exactly how much to push or pull to achieve the proper correction without over-correcting. In technical terms, you've tuned the P term.

Using just this P process get's you heading in the right direction. Now how does the I and D term come into play? If you just relied on P then the prevailing wind and current would still knock you off course and you would pass the mark never having touched it. Rather, you would constantly correct to point at the mark, but more likely orbit around it. So the I and D terms are going to help you account for external influences and reach the mark exactly.

So realizing there is a prevailing wind you point the boat upwind.

In your head, you analyze how much your corrective action is having an effect and after a few observations you determine you need an extra 5 degrees wind-ward to stave off the amount you are losing due to wind or current. It's not necessary to measure the wind and the current, it's easier to just analyze where you are now and where you were a minute ago and make a guess-timate as to how much you need to correct for all the external factors. This is the I term! The larger the I term the more you will correct compared to how dramatic you feel are the external factors.

Put another way, the I term helps you reach the target precisely even when external factors are in play. "I" is short for integral, but I won't bore you with math. In actual control systems like our copter, the P term will start to get small (weaker) as it gets closer to the target and the I term will be there to help give it that final push that brings it to the target rather than just narrowly brushing by it. Problem is, be it a copter or a sailboat if you over-correct too much you end up going over the mark which is just as bad. Too much P or I term will cause a sailboat to miss the mark and a copter to wobble or oscillate.

I is also the only term that is affected by historical observations, where P and D are more "in the moment". That is that error measured over time adds up over time to make the correction stronger if the error is not going away. So a side effects of the I term is that it can "wind up" like a spring and overshoot the mark causing the oscillation effect.

So finally we are left with the D term. "D" stands for derivitive, but again let's avoid the math and just call it the "dampening" term as that is exactly what it does. It works against the P and the I term and is based on the rate of change of the copter or boat. Where I is focused on external factors, D is focused on what the boat (or the copter) is doing. This would be something like you, the skipper, saying, "ok, so far I've been needing to correct by this amount, *but* (1) I am turning too fast and my inertia can carry me there, or (2) a wave steered the boat but towards my target so release pressure on the rudder a bit, or (3) a gust caused me to over-correct the last time, so let's hold off and let the gust do the correction for me." In all these cases, you are feeling what the boat is doing and reacting accordingly and against what the P and I was telling you to do. D primarily counter-acts the effect of the I term.

So how does this relate to our copter? PID control is found all around you. It's in the cruise control system of your car, your heat or AC system, your oven, those little smart-phone power adapters and like I said before, it's also an algorithm we've naturally developed along with most other animals. In fact, it was inspired by observing the action of helmsman. You can read more about it on Wikipedia.

In our multi-rotors there are a number of PID control loops, one for each axis, that control the balance between motor output and desired roll/pitch/yaw. First using the accellerometers and gyros, they measure the actual roll/pitch/yaw and compute the angle error based on the desired/target angle. Then this error is multiplied by the P term to determine the initial amount of power correction to send to the motors, this correction could be positive or negative and is added to the amount of throttle input. Then just like the sailor this angle error is propagated through the I and D processes to further affect the amount of correction. The P, I and D terms work together to keep the copter constantly seeking the target attitude, balance and direction.

So now that we know the basics, how do we tune the P, I and D terms? There is no easier way to do this beyond trial and error, just like practice and experience does for us. There is complex math that can get initial values but I did say, "there is no easier way..."

The book on PID would tell you to blah-blah-blah. However, our PIDs are already pretty close so I wouldn't recommend the book method. Let's make it simpler:

- Do you have a small copter, such as a Gaui-330 or any <350mm quad? If so, then start with ROLL and PITCH PIDs at P2.0/I0.023/D26 then follow the same process as below. For anything close to 420mm or above the defaults are a good starting position.
- If you generally have good flights with only marginal wobble then you can decrease P and I terms a few notches. More I than P. With a little adjustment of these two values you should have perfect copter control with no wobbling at all.
- For large wobble or imbalances you can adjust P and I down more drastically. Decrease more P than I in this case, until you get in the right range, then play with I up and down. To low P value will make the copter sluggish, so we want P as high as possible before instability, then reduce P just a bit to compensate for increasing I back up until you get the best flight performance.

FYI: If your copter can't get off the ground it's more likely you have motors connected wrong. 400mm and above copters will always fly with defaults. The 330s with full size motors are the only copters I've seen have difficulty with default settings and even then they usually will get off the ground ok but fly a bit funny.

If you want to get fancy, the best way to tune is to attach a bluetooth link and use an android device to tune in the air! You'll need a friend to make the adjustments while you fly.

Start with I and D zero, and increase P until it works then pull back a bit and apply I until it is better but has some wobble, then apply D until it stabilizes. This is likely what Alex did when he created MultiWii but it doesn't help us here. Other than, if there is considerable instability, it might help to reduce I and P a lot, then increase P and I like so until stable.