[HOW-TO} Writing your own autopilot using SimConnect and JavaScript

Did you ever want to make a little google map webpage that you show your flight on, as alternative to the in-game map? Maybe visualize your flight path on it? And then maybe have some buttons so you can trigger things in-sim? And then maybe have one thing lead to another and spend a few weeks writing a fully functional autopilot, with auto-takeoff and auto-landing, all in node/browser JS rather than having to first learn, let alone properly write, C++ code and compiling add-ons?

Then I have good news because so did I, and I ended up writing a full tutorial on the process, freely available over on Flying planes with JavaScript. It features both the basics (LVL/ALT/HDG modes) but also terrain follow, auto takeoff, auto landing, and waypoint navigation based on just putting markers on a google/leaflet map in the browser and dragging those around rather than programming airport and VOR codes.

And of course, if you just want to see it in action rather than reading through the entire tutorial and writing along, you can grab a copy of the project from the github repository and then run it locally.

But remember: it’s still an autopilot, it’ll absolutely kill you if you tell it to fly through a canyon and ask it to coordinate some tight turns =D

Also, I did some video recordings while testing autoland, so if you want a little taste of what the code can do, and what the tutorial will cover:

An Initial daytime test

A nighttime test (the AP doesn’t care of course =D)

A full flight in beautiful New Zealand’s Wānaka lake region

The discussion thread for this project is over on A tutorial on writing an autopilot using SimConnect and JavaScript

2 Likes