I wrote a super basic 2 axis "autopilot" with Python for X-Plane. The concepts are super simple. Getting the controller tuned properly is not.
For a surprisingly large number cases, setting a P value in the 1-3 range and a I value as P/10 works extremely well.
I now write Python for my day job. This code was written before that and now that I look at it, it is quite ugly:
https://austinsnerdythings.com/2021/10/19/coding-a-wing-leve...
A different part of my day job includes, tangentially, tuning PID control parameters for 200-500 HP electric submersible pumps in oil wells. Again, it is amazing how setting an P value in the 1-3 range and an I value P/10 works there as well.
A slightly more advanced autopilot with altitude set and hold (code is even more ugly):
https://austinsnerdythings.com/2021/12/06/coding-a-pitch-rol...