Creating an autopilot in X-Plane using Python
21–30 of 34 posts
Re: Creating an autopilot in X-Plane using Python
#22The Connect API for X-plane is a great toy. I wrote a "recover from upset" script some years ago after having a discussion on the best methods for upset recovery by human pilots. You can easily implement something that does what a human would do and then compare other options that may be possible. The one thing that does make it a bit "easy mode" is that all data is clean and exactly as you would expect mathematicall…
It also seems like the chance of having had sensor failure or disagreements is higher in cases where a human pilot (or autopilot) has lost control of the airplane or exceeded autopilot limits. (It’s by no means all cases, but some LoC incidents are initiated/contributed to by a sensor or avionics failure.)
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.
Re: Creating an autopilot in X-Plane using Python
#23if you want more than just an autopilot I have a almost all 747 400 systems modelled in lua open sourced for xplane 12 at 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
Re: Creating an autopilot in X-Plane using Python
#24The 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.
Re: Creating an autopilot in X-Plane using Python
#25Wow. Wouldn’t have guessed that a commercial game gets used in certified simulators
Bonus: it supports Linux!
Re: Creating an autopilot in X-Plane using Python
#26if you want more than just an autopilot I have a almost all 747 400 systems modelled in lua open sourced for xplane 12 at https://github.com/mSparks43/747-400 CBTs linked in an issues milestone.
> CBTs 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)
Re: Creating an autopilot in X-Plane using Python
#27You've reminded me of the actual autopilot that was based on some X-Plane shenanigans too ;) https://www.x-plane.com/hardware/evo/9_seeker/Seeker.html
Re: Creating an autopilot in X-Plane using Python
#28Cool stuff, Austin! Really liked how you upgraded the X-Plane autopilot with Flask and Redis. Makes tweaking those set points way smoother. It’s neat to see Python take on complex tasks like this. Ever think of messing with this setup for other sims, or throwing in some trickier algorithms? Cheers for laying it all out there!
Plans include: Direct to, navigating from waypoint to waypoint, automated takeoff, and maybe tracking a ILS/LOC.
Re: Creating an autopilot in X-Plane using Python
#29Wow. Wouldn’t have guessed that a commercial game gets used in certified simulators
Kind of makes sense that a company with relevant expert domain knowledge can double-dip making both pro and game stuff.
Re: Creating an autopilot in X-Plane using Python
#30You can also do this for Kerbal Space Program using the kRPC mod: https://forum.kerbalspaceprogram.com/topic/130742-18x-to-112... . It's a much less polished experience, but you get more of the experience of an actual avionics/robotics project doing it this way - multiple sensors that may not necessarily agree with each other (for example, IIRC accelerometers installed at different ends of the ship will register diff…
If you want a simpler intro into learning the math/logic behind rocket guidance systems, kOS is an alternative mod. 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://ww…
The community is really active, with a lot of challenges like spaceX booster landing.