I orginaly posted this some time back and have been asked multiple times for it, so here it is, easy to find with a few edits from further learning/tuning experience.....

Let me define CSD as transmitter Control Stick Displacement. In the case of MultiWii, 1500 is center, so the control channel receiver output -1500 is CSD. This value will be positive or negative number depending on direction of stick displacement

And define GYRO as the gyro output. The gyro(s) are calibrated to zero at start up. Sense of angular velocity is a positive or negative number depending on direction of rotation. GYRO is a measurement of angular velocity like degrees/second or RPM.

There are 4 items that make up the output of the PID forumula.

1) CSD

2) P is GYRO *times* the P coefficient. "P" will always try to stop any and all angular velocity(pitch, roll or yaw movements). This result drives GYRO back to zero and stops motion.

3) I is the cumulative sum of the CSD - GYRO. This is trying to match the GYRO to CSD meaning the CSD is really trying to act like a request for angular velocity(gyro output). If the angular velocity matches the perceived CSD request for angular velocity the result would be zero. Don't forget it's cumulative, each time it's calculated, it's added to the previous result. So the "I" term can and will "wind up" but is limited to a maxium sum which is about +/-20 degrees of rotation. This "I" term is what I think of as heading

*...Continue Reading*