PID Control in Autopilot for MSFS -- looking for 2nd Opinion

Out of Curiosity, have you ever programmed a SIM, or any sort of PID system ? :woozy_face:

Brother in Arms, I have not programmed a sim.
But I had much fun using MATHEMATICA and MATLAB/SIMULINK
to play with flight mechanics and control theory.
(I have a degree in aeronautical engineering and some idea of control engineering, - regretfully no longer fluent )

Reading between the lines, I guess your answer to my question is : no way
YET, disturbances put aside, the plane then follows a determinisc flight path once you specify the initial conditions. To find the right ones could make trouble.
Disturbance rejection would no longer count.
Intercepting and following a prescribed flight path, using PID , now using the integrator mostly, might be the most elegant way.
Nevertheless NOT using control theory might be possible.

I don’ t want to try it !!! :wink:

bye, walter

PS.:
I did not even try to read the “Asobo textbook” on PID control.
I am sure this kind of SDK help was well intentioned. But no one
without a good prior knowledge of control theory would become happy with it.
If you need optimal values for your PID constants, you could use the PIDTune functions for example in MATLAB or MATHEMATICA . Yet you would have to decide which semiempiric model you like PIDTune to use for calculating PID values.
One model may be excellent in disturbance rejection, the other excellent in flight path following.

Good luck !

bye

Depends on how good you want the autopilot to be. You can implement an autopilot using first principles feedback loops (“if we’re too much X, do Y to counteract that, keep doing that until we’re no longer too much X”), basically implementing the “proportional” part without calling it that, and then add in additional bumps and counter-bumps based on “how fast things are going more wrong” (effectively modelling the integral part without calling it that) and “how much we over-corrected last step” (i.e the derivative part) and get something that works well enough without ever explicitly writing PID code and knowing control theory, but just like a real autopilot: it might still kill you if you look away. I did this over on Flying planes with JavaScript | are-we-flying for instance, and changing alt with an ultralight does not end well =D

PIDs are just the “logical conclusion” of modeling linear (or close enough to linear) feedback loops where all three aspects are taken into account automagically by the same tidy little package, at the expense of “tuning them is now your day job” (I hope you remembered to implement debug plotting, because without it, no amount of parameter tweaking is going to make you understand why your changes do what they do). They’re the kind of thing you reach for once you’ve implemented enough AP code to go “okay I’m literally dreaming proportional step correction, error accumulation correction boosts, and slope-to-target based counter corrections already, I think it’s time I give PIDs a try”.

2 Likes

Have any of you tried using this online tool?

http://grauonline.de/alexwww/ardumower/pid/pid.html

I was planning to have a play around with some of the planes I have where the AP can be a little too aggressive, leading to overshoots, and see if this can assist with improving things.

Sounds good – will be most interested to see what you come up with 


AP-Tune_C172