PID stand for Proportional-Integral_Derivative. It is used to automatically do actions based on constant input from surrounding.
Syntax:
PID(target, input_data, P, I, D)
target is the target value that the PID will attempt to achieve and maintain.
input_data is the value that the PID will attempt to modify.
P is more or less the power i.e how much force the PID will use to achieve and maintain the target.
I is basically how quickly the PID will work.
D is how careful the PID will be.
That probably is not enough to understand, so lets take an example.
I want to make a Pitch stabilizer. So i will take my wing and in the inputid section ill put:
PID(0,PitchAngle,0.1,0.1,10)
where
0 is the target, in this case the pitch angle of the craft
PitchAngle is the default variable i will use as input for the PID.
PIDs are super case specific, what works for me may not work for you.
To tune a PID, the method i use is just trial and error. Modify one variable at a time.
Increase P until you see a steady, constant oscillation. In our example it will be the pitch going up and down in a constant manner.
Then, increase D until you achieve an acceptable amount of dampening. Increasing D too much will cause more oscillation
Finally, in a very careful and minute amount, increase I, until finally, you have a constant output, in our case the Pitch Angle remains at 0.
That's it. I have a plane that uses this for a Pitch Angle maintainer thing. So check that out.
I guess you could say it's just piddling around
another young soul discovers the magic of PIDs
very helpful,tyyy :))