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.
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 different readings!), you have to be quite a bit more careful when interfacing with engines and may not have access to a simple "go left" control input, you have to deal with whatever nightmare vehicle you built that you need a computer to handle, that kind of thing.
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
kOS is a very fun rabbithole, the language can strange at first, it's a reactive paradigm with a special flow. I started with the [PID tutorial](https://ksp-kos.github.io/KOS/tutorials/pidloops.html) to learn PID in a fun environnent. Then programming orbital maneuvers to dig into orbital mechanics.
The community is really active, with a lot of challenges like spaceX booster landing.
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 mathematically. While real input data for avionics is more noisy and has several types of sensor errors.
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.)
Absolutely. I've had an instrument failure (invalid attitude indication) cause an autopilot issue that put the aircraft in an upset state in seconds. From there you're manually recovering based on limited data. Fortunately this is a key part of training and unlike the autopilot a human pilot knows to look at the backup instruments and make a judgement on what data is correct.
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.
I have been wanting to play around with drone swarm simulated behavior, does anyone know of a sim that would let me do something like this with 10 or so drones?
O wow. I was not aware of the NASA plugin. I wanted to build a simple dashboard on a separate screen for a while (I run X-plane with a cheap projector which is good enough for the scenery but not for the 6 pack). Each time I explored this I end up with what seems to be windows-only solutions.
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.
25 years ago I did the same thing with MS flightsim as an interesting project. I took a similar approach except I was using Java.
I got as far as being able to navigate to lat/long fixes.
Learnt quite a bit in the process
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!
Yep, I've got plans. But other projects that compete for time, including raising a 1.5 and 3.5 year old. And working on a Tinder for Restaurants (https://monchmatch.com).
Plans include: Direct to, navigating from waypoint to waypoint, automated takeoff, and maybe tracking a ILS/LOC.
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
Airlines call them CBT as well, although it's really "iPad based training" at most airlines.
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.
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)
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...