P & I Gain / Limit (Englisch)

P & I Gain Explanation

the PI(D) gains define the amount of gyro (and receiver Rx - i.e. the user input) response which is to be then applied via the mixer to the motors.

Gyro -> apply P-gain(+I-gain) -> mixer -> motor

E.g.: taking the P-gain, since this is easier to understand if Roll gyro produces an output of say 60 (these are ADC units) and the gyro P-gain is say 50%, then a number of 30 will be applied to Roll axis. This number will then be processed thru the mixer, so for + mode, it will apply the full amount to the 2 Roll motors (left + right) but for X mode, because there are 2 left and 2 right motors, the 30 is halved and 15 is applied to each motor (one sided is increased, the other is decreased).

so, yes, as you pointed out, the PI(D) gains should stay the same since the editor takes into account the different motor layout

The P-gain relates to the gyro gain (current errors), whereas the I-gain relates to long-term errors (think of this as past errors).

Details on the P & I Limits

note that this is what I believe the limits do, as I didn’t write the software…

the P-Limit is the maximum (+/-) output after applying the P-gain to the gyro output e.g.: if P-Limit=100, P-Gain=50(%) and the gyro outputs a figure of 250 (<- note this could be + or - depending on which way gyro turns), then: 250 x 50% = 125 but since this exceeds the 100 limit, will be reduced to 100

the idea (I believe!) is to control the motors better under extreme conditions and probably only comes into effect when copter hits an immovable object :slight_smile:

The I-Limit is a similar but is applied to the I-term. I didn’t mention this earlier as to what this is as it gets a bit complex math-wise, so, to explain it in simple terms: the I-term increases the motor response over time if the condition cannot be satisfied

E.g. if user moves the stick, the motors will change speed to perform the movement, but, if say the actual movement is insufficient (as measured by the gyros), the motors will be increased over time to try and force the correct movement. the I-limit simply limits how much of this ‚extra effort‘ will be allowed

the output from the I-term calculations is added to the P-term output and fed into the mixer

So I-term is to correct long-term errors

Other explanation

Being a mechanical dude by nature, it is more practical for me to think of PID’s as car suspension with airbags. The P is the stiffness of the springs, Pmax is the shock travel, D is stiffness of the shock absorber, I is the speed at which the airbags can fill up or deflate, and Imax is how big/small the air bags can get. Springs create more force when they are stretched, shocks create more force with more „velocity“, and the airbags are used to perfect ride height depending on loading, springs getting weak, etc… Instead of the system controlling the ride height of the car and the bumps felt in the chassis, a PID controls any aspect of flight… X position, Y position, attitude, altitude, velocity, etc.

FWIW, the way I was taught PID tuning in college… you first measure the aircraft’s response to step and oscillating control inputs and external disturbances. Use that data to characterize any natural frequencies and the various control authorities. Then you’d apply GN&C theories, do some math transformations, bode diagrams, etc… and solve for the optimal P, I, and D values. The resulting FC’s would respond very fast with little or no overshoot, and have no unstable modes that a pilot couldn’t easily control (oscillations on the scale of minutes, usually due to I term errors).

I have heard the APM guys discussing the possibility of „auto tune“ in the future; probably use FC output to create specific frequency & step disturbances in flight, measure time response, and adjust PID’s accordingly using proper control systems maths. That’s probably going to require good piloting to do, but could give professional results in a few flights… perhaps better than you could ever hope to tune in a life time of trial/error tuning.