Board index FlightGear Development Canvas

Need to Create a Standalone PFD

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

Need to Create a Standalone PFD

Postby deena102 » Fri Jul 18, 2014 12:58 pm

Hi,

I'm am a Long time user of Flight Gear, but I know absolutely nothing about Development in Flight Gear.

I'm now in a need to create a Standalone Primary Flight Display with following requirements

1) Should be able to listen to Socket in which Flight Parameters like Pitch, Roll, Altitude etc(published by another system) are available.
2) Use the parameters to show a 2D Graphics of Primary Flight Display with Artificial Horizon, Pitch Ladder, Bank Angle indicator etc..

Is it possible for me to develop such Standalone PFD using Canvas Framework?? If not which will be a good platform to do the same.

It should run in Linux Operating system.

Thanks in Advance.
Deena
deena102
 
Posts: 6
Joined: Fri Jul 18, 2014 12:50 pm

Re: Need to Create a Standalone PFD

Postby Hooray » Fri Jul 18, 2014 1:09 pm

Hi & welcome!

Depending on your requirements, using the old FGPanel code may be the simplest option: http://wiki.flightgear.org/FGPanel

But you can also create a Canvas-driven PFD using a subset of FlightGear, called "FGCanvas", even though that will require some additional work (some of which we've been doing recently), and being able to rebuild from source will be a plus - but it will be much more flexible that way, and not subject to the restrictions that FGPanel has: http://wiki.flightgear.org/FGCanvas

To learn more, please see: viewtopic.php?f=71&t=20401

Depending on your background/time frame, FGPanel should get you going very quickly (without requiring ANY coding), while FGCanvas would involve more tinkering, and provide much greater flexibility obviously. Using FGCanvas, you'd basically create your PFD via Inkscape, as an SVG file and then animate it via Nasal callbacks.

For the sake of completeness, you could also use a completely different approach suggested by TorstenD: the new integrated mongoose httpd and JavaScript/DHML to create an animated website and serve that via FG (which would have nothing to do with FlightGear's hardware-accelerated Canvas system):

Subject: Instruments for homecockpit panel.
Torsten wrote:The fgpanel is an extract of old fg functionality, the old 2d panel code to be more precise. It's goal is to run standalone on old and/or slow hardware and to render old steam gauges with great level of details. I would not suggest implementing PFD/MFD like devices using FGPanel as there are better ways to do so.
I am currently experimenting with HTML5 Canvas and SVG using the new websocket and AJAX interface. No more spooky XML files, no proprietary scripting language without a debugger. Just standard HTML, CSS and JavaScript and 100% cross platform.
Of course, thats for external displays only. For displays inside 3d models, the FG-Canvas/Nasal is the way to go



That would be more flexible than FGPanel, but less "native" to FlightGear than FGCanvas, and obviously also not hardware-accelerated. Also, you probably wouldn't be able to easily reuse any existing Nasal/Canvas PFD code that we have already, e.g.:

http://wiki.flightgear.org/Canvas_PFD_Framework
Image

If you are a Linux user, familiar with building from source, and maybe even git/gitorious and some C++, I'd suggest to get involved in the FGCanvas effort - we can provide all the pointers that you need and can get you started within a couple of days to end up with a working "FGCanvas" PFD using existing patches and code.

You'll mainly have to build a custom branch (i.e. apply a patch) and most other things are mainly a matter of adapting the existing PFD Nasal code to generalize it some more.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Need to Create a Standalone PFD

Postby deena102 » Mon Jul 21, 2014 5:12 am

Thanks a Lot for your detailed response. I have digested every point you have said. I'm convinced that FGCanvas will be my best option. And also I will be glad to contribute to the PFD Framework. Kindly help me get started.
deena102
 
Posts: 6
Joined: Fri Jul 18, 2014 12:50 pm

Re: Need to Create a Standalone PFD

Postby deena102 » Mon Jul 21, 2014 5:18 am

I want to confirm one thing. I need this PFD Application running in isolation listening to a Specific port for Flight Parameters. I see Nasal as a integrated platform for Flight Gear. Will I be able to use this as I intended without having to invoke Flight Gear?
deena102
 
Posts: 6
Joined: Fri Jul 18, 2014 12:50 pm

Re: Need to Create a Standalone PFD

Postby Hooray » Mon Jul 21, 2014 7:30 am

basically, what we're calling "FGCanvas" will be FlightGear minus a number of subsystems - i.e. a subset of FlightGear. But you will start FlightGear twice: once in "FlightGear mode" and once in a subset of it, which we call "FGCanvas" - the 2nd instance can also be running on a different computer/network obviously.

It's been shown that roughly ~60-70% of the subsystems in FlightGear would not be required for FGCanvas - so, those would be explicitly disabled for the FGCanvas mode.

Which also means that the hardware requirements will be much lower.

Basically, you can imagine it like 1) osg, 2) canvas and 3) Nasal - even though there are a handful of additional dependencies required. But otherwise, that's basically what FGCanvas is all about.

Which means that you can run Nasal, but also I/O protocols - because all the FlightGear infrastructure would be -optionally- available.
Performance in "FGCanvas mode" is pretty remarkable, too (see the frame spacing/frame rate counters):

http://wiki.flightgear.org/FGCanvas
Image

If, and how, you'd want to proceed from here, depends mainly on whether you are able to build from source or not.
The two wiki articles I posted, contain a few pointers. But basically it's a 3-step process:

  • making unneeded subsystems optional, and rebuilding FlightGear
  • adding an I/O protocol that syncs PFD properties (altitude, position, velocities etc) with the "FGCanvas" instance
  • generalizing the existing PFD code accordingly to come up with a PFD framework

The I/O protocol part can be greatly simplified by simply using FlightGear's support for multi-instance slaving, i.e. you'd basically disable the FDM/controls part on the FGCanvas side of things, and simply use those values from the FG side:

http://wiki.flightgear.org/Slaving_for_Dummies
http://wiki.flightgear.org/Property_Tre ... ol_Slaving

The steps to make subsystems optional, to exclude them, are not really difficult - for a recent thread, see: viewtopic.php?f=71&t=23499
To get this going quickly, you can just comment out unneeded stuff (e.g. sound, fdm/flight etc).
Even though a more proper solution would be using properties to exclude subsystems optionally.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU


Return to Canvas

Who is online

Users browsing this forum: No registered users and 0 guests