[HN Gopher] Flying planes in Microsoft Flight Simulator with a J...
___________________________________________________________________
Flying planes in Microsoft Flight Simulator with a JavaScript
autopilot (2023)
A (lengthy!) tutorial on how to write your own JS-based autopilot
code to fly planes in Microsoft Flight Simulator with a web page to
both visualize the flight and control the AP. Note that this is a
complete do-over of a previous page that used a combination of
Python and JavaScript, and only covered basic autopilot
functionality. This rewrite threw all of that out, and goes much,
much further: you just want to have the plane take off without
having to do anything? Check, this tutorial covers auto-takeoff.
Flying with waypoint-based navigation, not by "programming airports
and radio beacons one letter at a time with a jog-dial" but by just
placing markers on a map and dragging those around as you please,
mid-flight, Google Maps style? Check. After all, why would we not,
putting a map on a webpage is super easy (barely an inconvenience).
In fact, let's throw in flight plan saving and loading, so others
can fly the same route! And maybe you want the plane to fly a
fixed distance above the ground, instead of at a fixed altitude...
well: check. You'll learn about terrain-follow using free Digital
Elevation Model datasets for planet Earth. And of course the big
one, for the ultimate "click button, JS flies the plane start to
finish" experience: ever wished the in-game autopilot could just
land the plane for you? Well, it's a video game, and we know
programming, so: why not? We're also implementing auto-landing and
it's going to be amazing. If you play MSFS, and you're a
developer/programmer, and you've always thought how cool it would
be if you could just do some scripting for it... you can, there's a
_lot_ of cool stuff you can do! And of course if you don't want to
follow along and just want to have everything set up and ready to
fly your plane, just clone https://github.com/Pomax/are-we-flying
and have fun.
Author : TheRealPomax
Score : 73 points
Date : 2024-05-05 18:45 UTC (4 hours ago)
(HTM) web link (pomax.github.io)
(TXT) w3m dump (pomax.github.io)
| t0mas88 wrote:
| Nice! X-plane also has a great API to do these things with. It
| was created by NASA for research:
| https://github.com/nasa/XPlaneConnect
| TheRealPomax wrote:
| There's even a pretty great autopilot for x-plane post that
| makes it to HN every now and then!
|
| https://austinsnerdythings.com/2021/10/15/creating-an-autopi...
| userbinator wrote:
| A bit clickbaity of a title, but the material was far more
| interesting and in-depth than I expected, although there was no
| mention of "hunting" which can often occur in control systems
| like this.
| TheRealPomax wrote:
| What's clickbaity about it? The title is literally what we're
| doing: we're flying planes in MSFS using an autopilot that
| we're (progressively) writing ourselves, using JS.
| userbinator wrote:
| The title was changed --- it just said "Flying Planes with
| JavaScript" or similar when I first saw it.
| wkjagt wrote:
| That's still the title of the actual post. I like it
| though.
| bottlepalm wrote:
| > To allay any concerns: this is not about running JavaScript
| software to control an actual aircraft. That would kill people.
|
| SpaceX: Hold my beer (https://os-system.com/blog/javascript-in-
| space-spacex-devs-h...)
| TheRealPomax wrote:
| Mental note: hold off on considering taking SpaceX flights O_O!
| TheRealPomax wrote:
| Also note that this isn't a "let's learn to implement this thing
| that I already know works", where I already worked out all the
| problems and am just giving you a write-up that lets you skip to
| the final result...
|
| _We 're going to get things wrong_, planes are going to crash in
| myriad ways, and we'll discover how and why things go wrong, to
| hopefully figure out how we can navigate those problems. And
| we're going learn from our mistakes.
|
| Including learning to throw away all the work we did because
| that's the right thing to do =)
| kosolam wrote:
| Something in the page kept reloading it when scrolled down trying
| to read on mobile firefox
| TheRealPomax wrote:
| Yeah, you really don't want to read this on mobile. It's 200
| print pages, I have no idea how long you'd be scrolling.
|
| (I need a better nav menu solution for mobile, at the very
| least)
___________________________________________________________________
(page generated 2024-05-05 23:00 UTC)