Creating an autopilot in X-Plane using Python
austinsnerdythings.com
austinsnerdythings.com
I actually revisited this series a few weeks ago. I added a Flask/html frontend to control the autopilot setpoints (much easier/fluid than editing the code and restarting) using Redis as a quick intermediate "database" to store the setpoints.
I whipped up a post this morning demonstrating this to get it out there due to the volume of visitors who might find it interesting! Hopefully I find time to polish the post later.
Here it is https://austinsnerdythings.com/2024/03/24/adding-some-polish...
The main difference is that it has a pretty good base autopilot, such that you can give it a direction vector to point to.
The downside is that you have to learn a specific language for it, but you can also make your own language that transpiles as a fun project :)
Example of what's possible: https://www.youtube.com/watch?v=szsIL_0m2Qo
The community is really active, with a lot of challenges like spaceX booster landing.
The one thing that does make it a bit "easy mode" is that all data is clean and exactly as you would expect mathematically. While real input data for avionics is more noisy and has several types of sensor errors.
But that judgement is very hard to code into an automated system. Because there is also a bit of trial and error involved. If indications don't follow your inputs, you're going to assume those indications are wrong and put more weight on the others.
The NASA plugin supports a Mac version and it exposes a bidirectional interface to X-plane served up through UDP.... then they provide sample clients.
This worked out of the box, on the Mac I did have to run X-plane in Rosetta2 but I was able to wire this up in a Python web server (native) so now I can display flight data real time in a web browser, nice.
Thanks for getting me on track and good job on the autopilot, will check that out later.
Plans include: Direct to, navigating from waypoint to waypoint, automated takeoff, and maybe tracking a ILS/LOC.
Bonus: it supports Linux!
https://github.com/mSparks43/747-400
CBTs linked in an issues milestone.
I wasn't familiar with what that acronym meant in the context of X-Plane but it seems to be "Computer Based Training", and after watching one of them I'm thankful for the 2x playback rate on youtube because whew
CBTs are/should be the starting point to play with any of the "big planes" (anything that needs an ATPL licence to fly), because the systems are pretty complex and unique to the aircraft, they aren't like cars that when you've driven one you can drive them all (licences are actually specific to aircraft designs, known as type ratings)
For flight sim hobby you can definitely watch CBT at 2x speed and just grasp a high level view on what buttons to press. But for real world flying you need the level of detail you see in CBT.
For example you really want to know what happens when you loose specific hydraulics systems and how things like accumulators can affect that. Because it could be that you only have the brakes work for a few applications (using accumulator pressure). Definitely not a good idea to taxi after landing like that.