Live data from Hacker News

Creating an autopilot in X-Plane using Python

austinsnerdythings.com

11–20 of 34 posts

Re: Creating an autopilot in X-Plane using Python

#11
post #10

You 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://www.youtube.com/watch?v=szsIL_0m2Qo

Re: Creating an autopilot in X-Plane using Python

#12
post #11
post #10

You 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…

kOS is good stuff, yeah. Very... immersive, heh. It has all of these weird design decisions from having been built to do relatively simple spaceship sequencing tasks first, rather than as a general purpose programming language, and having grown over time to do arbitrary stuff. That history gives it this really uniquely crunchy feeling that you just wouldn't get with a more modern, ergonomic system.

Re: Creating an autopilot in X-Plane using Python

#13
post #2

The 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.)

Re: Creating an autopilot in X-Plane using Python

#14
Austin from Austin's Nerdy Things here - super stoked to see my blog's traffic at 7x the daily average at 7am! Thanks to all the visitors!

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...

Re: Creating an autopilot in X-Plane using Python

#15
post #12
post #11

Earlier quoted context omitted.

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…

kOS is good stuff, yeah. Very... immersive, heh. It has all of these weird design decisions from having been built to do relatively simple spaceship sequencing tasks first, rather than as a general purpose programming language, and having grown over time to do arbitrary stuff. That history gives it this really uniquely crunchy feeling that you just wouldn't get with a more modern, ergonomic system.

To be fair, theres also the kIPC mod that bridges and connects both kOS and kRPC together. I personally like the kerbal-y equivalent of Ada with kOS though ahaha

Re: Creating an autopilot in X-Plane using Python

#16
post #2

The 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…

The numbers coming from X-Plane are indeed super "clean" and very mathematically expected. No lag on VSI, etc

Re: Creating an autopilot in X-Plane using Python

#20
Cool 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!
Post reply on HN