Avionics Programming

Hello
Im trying to find resources to learn how to program modern avionics

I was wondering if anyone in here can recommend me a book or tutorials on the subject, so far Ive only found things regarding autopilot control but Im more interested in how map screen and flight lines are plotted into it

thanks

1 Like

Isn’t there any way of “exploring” already existent planes? I haven’t investigated it yet, but I would start right there. Open up the 172 for example, it has 2 screens with standard avionics. I don’t know if the source is available though

Just guessing but here goes…

You may find clues in the Packages folder in a directory called asobo-vcockpits-systems as well as the GaugeAircraft sample in the SDK folder, though things are a little unclear to me when I’ve tried to figure out what’s going on there.

My guess is the rendering is done using nanovg.js. Variables, constants and common FS2020 and datatypes are in gauges.h. I was hoping gauges.h wouldn’t be a core part of gauge programming as it makes heavy use of macros, which make reasoning about C++ code a bit of a headache if you ask me. I was hoping to see more modern C++ constructs and language features.

Current avionics like the G1000 will likely be running as a sandboxed WebAssembly module (WASM). I think the main problem is that the source for most of the logic behind the G1000 for example is likely inside one the the FS2020 file packages that are compressed into .fsarchive files and therefore inaccessible.

I guess we’ll have to wait on the devs to flesh out the gauge SDK documentation to give everyone a clear picture of the fundamentals of the gauge logic and rendering framework we need to use. Hopefully the next SDK update will greatly clarify everything and I certainly hope they do a better job than the FSX SDK docs :slight_smile:

1 Like

The avionics code for all planes is using the new htmlgauge interfaces, i.e. html + css + javascript, and is already available to inspect and play with. See this thread for mode details:

Specifically FS2020, or more generally?

Plenty of tutorials on GDI and OpenGL on the 'net for total beginners. DirectX is a bit heavy (and Microsoft proprietory). Avoid DirectX2D. Stick with DirectX3D. Whoever thought up D2D was drunk at the time, and the API is absolute rubbish.

More fundamentally, you want to start with game engine development, and how to create basic game loops, input/output handling, events, and setting up a basic framework for your OS of choice for maximum performance. You can have a basic loop ready for drawing in a couple of hours.

http://www.gamedev.net/ is a good resource, and if you Google there are some good resources for games development out there that will get you started with graphical frameworks.

Once you’ve got a solid foundation, avionics development will be a walk in the park.

Im looking for things more specific to the avionics logic rather than its computer implementation

you see I can google Opengl graphics and thousands of tutorials pop up, thats what your reply boils down

but things like how map displays handle world data or a parser for airac procedures and waypoints

for things like these the closest you can get is some tutorials using google mobile map API

Ahh… you have to write all that yourself.

There are no frameworks or tools that will do this for you. There are data sources; some free, others paid for. Pick one, learn the data format, see if it is suitable for your needs, and get programming.

There is no free lunch, no drag-and-drop interface for development. Just knowledge and skill in software engineering and mathematics, and a knack for logic and planning (software can lead you down roads that you have to dig up the entire road to fix - you need to be good at spotting the dead-ends before you make the turn).

some much for “a walk in the park”

I’m impressed how there is literally zero discussion on the subject anywhere on the web yet every other programming topic is discussed plenty

You can’t teach logic. Programming is 99% logic. The rest is mathematics (computers only understand numbers).

That is why there is no discussion. It’s like discussing how to breathe in order to start discussing plant life. Everyone who needs to know, already knows.

If you have never written a line of code in your life, you need to start at the beginning.

Microsoft do a series of tools for development call Microsoft Visual Studio Express (now Community). I suggest you download it (latest is 2019), and learn C++.

Don’t get distracted by Basic or JavaScript (or Java for that matter) as they do lots of very clever stuff that will get you in trouble later when you need to write real software.

Here’s a basic program I ask everyone I teach to write software to analyze, pick apart, and not come back until they can tell me what every line of coding is doing (it’s a deceptively complex program for beginners, but contains 90% of what you need to get started).

#include <SDKDDKVer.h>
#include <stdio.h>
#include <tchar.h>
#include <conio.h>

int _tmain(int argc, _TCHAR* argv[])
{
	printf("Hello!\0");
	_getch();

	return 0;
}

Explain to me what every single line does, and how it works.

are you for real? also thanks for derailing the thread , I was eager to receive valid inputs on how to proceed with this

also btw I have 7 years of c programming in the video game industry save any more gamdev.net links and basics for others

thank you

1 Like

Well why didn’t you say? You came across as rank beginner with your questions of “how map displays handle world data”.

If you’re asking those questions with 7 years of experience, you’re going to have problems.

Refer back to my first reply - you need to write it all yourself.

1 Like

ok thanks!, I will kindly ask you to stay away from this topic your message has been received and it seems you have nothing else to offer

regards

2 Likes

My guess is Coherent is specific for UI elements and behavior only and maybe Nanovg is for the anti-aliased shape primitives like polygons, lines and line styles etc. I may be wrong and frequently am :slight_smile:

1 Like

Using existing libraries also means less code for us to have to write and maintain ourselves too yes? :slight_smile:

I hope I understand yourt question correctly so forgive me if I’ve got it all wrong but I fear you may find it difficult to track down specific discussions on the topic of avionics logic DevlNando :frowning:

I think that esoteric discussion is likely locked up in the heads of embedded-system programmers at Garmin and Avidyne who have commercial interests to protect. Then again maybe some discussion could be out there in an open-source mapping community such as OpenStreetMap? I haven’t checked but maybe the Google search term you could use is geomapping libraries?

There are two parts to this avionics equation, rendering the displays and retrieving data. Tutorials for the rendering will be readily available depending on what graphics API you use. I think nanovg is used for rendering map primitives such as lines, map symbols, airspace boundaries etc. Coherent is likely the library used to provide general UI elements and behavior. As for the simulation data we’ll have to wait for SimConnect API documentation to be fleshed out.

Regarding ‘avionics logic’, this will be the culmination of the code you write in order to glue the rendering and the data retrieval via SimConnect together in order to emulate the behavior of whatever avionics system you are interested in, be it a Garmin or Avidyne product for example. Your map screen and flight lines comment would then be your own code solution you come up with that uses the SimConnect API calls to retrieve waypoint data from SimConnect for the flight line, iterating over that list of coordinate to pass to a line-drawing function in nanovg for example, which will draw the line on whatever surface data structure the FS 2020 API the devs provide us so the FS 2020 engine can use it to display the resultiung map. It’s here the SDK needs development.

I think what we really need is discussion on the fundamentals of the lifecycle of gauge rendering and data retrieval within the FS 2020 game engine. From what I’ve gleaned so far it involves panel service functions into which we have to hook into in order to get our own gauge code initialised and playing nicely. It’s here where we need a discussion on the fundamentals of the sandboxed framework we have to play in when writing gauge code.

1 Like

Direct2D isn’t that bad is it? I know some people aren’t fans of the COM style interfaces and manual memory management but if you got past that it was quite powerful and DirectWrite was good for high DPI-aware text requirements. That said I only had exposure to it for three weeks before I had to move onto something else so if you’ve used it longer than me I’ll take your word for it :slight_smile:

The API is atrocious. If you want 2D drawing, use 3D with the Z parameter set to zero.

There is nothing wrong with “manual memory management”. I don’t understand why people even think that is a problem (failure to understand the basics IMHO).

Compare doing a task in D3D vs. D2D and the differences (and problems of D2D) will become apparent.

2 Likes

I’ll take your word for it. It’s been some time since I was prototyping stuff :slight_smile:

I know what you mean about manual memory management. All you need to keep in mind with raw pointers, in C++ at least is, what Bjarne Stroustrup calls RAII. Anyway, modern C+++ has smart pointers now.

1 Like

Smart pointers aren’t needed. They try to solve a problem that doesn’t really exist.

https://docs.microsoft.com/en-us/cpp/cpp/smart-pointers-modern-cpp?view=vs-2019

// Don't forget to delete!
    delete pSong;   

This really is the worst case of “hand holding”. If you can’t remember do to basic fundamentals properly, you really shouldn’t be writing software.

If freeing pointers correctly is too hard, there are waaaaay more programming mistakes you can make that are far worse than this, both in terms of severity and subtlety.