Board index FlightGear Development Aircraft

Cessna C182T with FG1000 glass panel

Questions and discussion about creating aircraft. Flight dynamics, 3d models, cockpits, systems, animation, textures.

Re: Cessna C182T with FG1000 glass panel

Postby stuart » Tue May 12, 2020 8:43 pm

Hi Folks,

Just to let you know that I've implemented resizing the windows dynamically - just drag the edges.

I've also committed the updated fascia from Michat for the GUI version. The 3D model is unchanged for the moment, as that doesn't use the svg file and requires more work.

-Stuart
G-MWLX
User avatar
stuart
Moderator
 
Posts: 1552
Joined: Wed Nov 29, 2006 9:56 am
Location: Edinburgh
Callsign: G-MWLX

Re: Cessna C182T with FG1000 glass panel

Postby Hooray » Thu May 21, 2020 8:38 am

Without having looked at your commit, but if you haven't already done so, I'd suggest to commit the SVG file, too - and by the way, there is a way to change the cursor at runtime to visualize the resizing option (not sure if you're doing that already?)

Some of these things could be made configurable at run time - I think a few folks mentioned they'd like to change some of these defaults, it'd be pretty easy to create an in-sim configuration UI procedurally by using a hash map with key/value pairs, a potential tooltip/label and description and a callback to validate/apply such changes. I've previously used this method to create fairly sophisticated UI dialogs procedurally (See Canvas Snippets article in the wiki)

http://wiki.flightgear.org/Draw_masks
http://wiki.flightgear.org/Howto:Reset/ ... leshooting
Image

It would be possible to add a custom button/action to the fascia (e.g. by clicking the SDCard) to bring up such a configuration page to show all configurable settings, so that people can tweak the FG1000 in-sim, while setting the userarchive attribute accordingly.

PS: pointer for cursor handling: fgcommand("set-cursor");, but I only just realized we previously talked about that idea here: Canvas G1000 and you mentioned you were slightly concerned about the performance impact of doing that ?
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: 11791
Joined: Tue Mar 25, 2008 8:40 am

Re: Cessna C182T with FG1000 glass panel

Postby stuart » Thu May 21, 2020 3:17 pm

Hi Hooray,

Good point on committing the SVG file.

Yes, I'm planning some form of config menu for the FG1000, which will include the default scale of the pop-ups and some of the configuration options etc.

The resize function is part of the canvas Window, not really something I have control of within the FG1000 itself.

So much to do, so little time :)

-Stuart
G-MWLX
User avatar
stuart
Moderator
 
Posts: 1552
Joined: Wed Nov 29, 2006 9:56 am
Location: Edinburgh
Callsign: G-MWLX

Re: Cessna C182T with FG1000 glass panel

Postby Hooray » Sat May 23, 2020 12:26 pm

Since you have already created a handful of FG1000 specific widgets (dropdown, combo box, navaid list): how much work would it be to generalize those and reuse them for such a configuration page (or even other avionics) ? Is that something that you'd consider feasible or not ?
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: 11791
Joined: Tue Mar 25, 2008 8:40 am

Re: Cessna C182T with FG1000 glass panel

Postby stuart » Sat May 23, 2020 3:35 pm

It would certainly be feasible. However I have only generalized control and some minimal animation logic (highlighting, scrolling) at the moment. What I found was that the G1000 graphics were quite use-specific. So I ended up creating the required SVG element in Inkscape as part of the pages themselves to ensure that they were rendered in the correct position and size. So the widgets have no layout or sizing logic, and I think one would need that to make them genuinely useful, along with programmatic generation of the canvas elements.

If I was going to implement the configuration for the FG1000 properly as a configuration screen on the instrument I would definitely want to generalize to include rendering the elements themselves, if only to stay sane! However, right now I'm tending to the view that it's going to be easier to just create an XML dialog for this. Most of the options are "set once" items, or things that would be configured for the airframe - things like whether the altimeter works in feet or meters.

-Stuart
G-MWLX
User avatar
stuart
Moderator
 
Posts: 1552
Joined: Wed Nov 29, 2006 9:56 am
Location: Edinburgh
Callsign: G-MWLX

Re: Cessna C182T with FG1000 glass panel

Postby Hooray » Sat May 23, 2020 3:58 pm

This is what I mentioned previously when I said you could create the whole UI procedurally - all you need is a vector with hashes to provide the corresponding meta information (label, tooltip, callback) and it's going to be less work than creating a PUI/XML dialog or a Canvas/QML dialog from scratch.

I can post the corresponding snippet of code, but it's actually all shown in the wiki article I posted previously. However, I don't think it's needed, since you're already using the same approach to procedurally create your Emesary notifications, i.e. a vector with hash map, that is then traversed - and like you said, it's a sure way to maintain your sanity. It will not look as nice as a custom-designed UI, but it will at least be highly functional that way.

Given your background/experience, you can probably see that this is the trivial portion, i.e. setting up a vector with configuration options that are encoded in the form of a hash map. The only other part that you'd need is a factory function for each kind of widget you'd like to be created.

Again, I've done this previously, so it's a straightforward option and I can post the code here - the other thing worth keeping in mind is that the Canvas system has a built-in UI system (which is what dialogs and tooltips are using anyway). In other words, there is a MVC-based UI system which can be used to reuse existing widget logic, which is even style-able that way.

This has already all the logic that you'd need to layout/resize as needed.

If in doubt, I'd suggest to check out $FG_ROOT/Nasal/canvas/gui: https://sourceforge.net/p/flightgear/fg ... anvas/gui/

Note that the parent widget class (Widget.nas) can be sub-classed, and styling/appearance is handled separately via the

https://sourceforge.net/p/flightgear/fg ... Widget.nas

For a list of existing widgets, see: https://sourceforge.net/p/flightgear/fg ... i/widgets/

The most straightforward widget certainly being the "Label": https://sourceforge.net/p/flightgear/fg ... /Label.nas

The actual implementation (the view part) is implemented here: https://sourceforge.net/p/flightgear/fg ... tStyle.nas

Again, at this point, I think it would be less work to create a procedural UI for something as trivial as a config page - but given that you mentioned elsewhere, that you'd like see other devices developed on top of your work, extracting a generic widget set for avionics specifically, might be a sensible option sooner or later.
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: 11791
Joined: Tue Mar 25, 2008 8:40 am

Re: Cessna C182T with FG1000 glass panel

Postby Hooray » Tue May 26, 2020 11:53 am

Hi Stuart, I've been testing the FG1000 on an embedded device, and noticed rather severe performance issues (200 ms / 5 fps) so here's a couple of observations:

- there seems to be a "leak" (for the lack of a better word"), i.e. the instrument isn't properly cleaned up after closing the window - you can see for yourself by keeping the osg stats open, watching the stats grow and then closing/opening new instances (in fact, you can tell from the number of the index shown in the title bar), or inspect /canvas/by-index via the property browser
- having an option to make the position/dimensions of the window persistent (userarchive) would be handy, i.e. per device index

For the sake of troubleshooting such things further, it would help if you could consider adding the draw mask patch (or some variant of that), so that each Canvas/element (or their placements) can be toggled on/off easily - that's a good way to tell how much is rendering related (patch available, but it's straightforward).

PS: disabling updates of the device, and dumping its scene graph to disk, re-loading the device in osgviewer/fgviewer, the frame rate is much better [1]

[1]: http://wiki.flightgear.org/Canvas_Troub ... hs_to_disk
[2]: http://wiki.flightgear.org/Canvas_Troub ... for_Canvas
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: 11791
Joined: Tue Mar 25, 2008 8:40 am

Re: Cessna C182T with FG1000 glass panel

Postby Knüppelrührer » Tue May 26, 2020 6:04 pm

small bug report with 2020.1.1 on last update:
Using "Using PFD" via menu and then closing it again results in the PFD of the cockpit freezing. Similar with the ND.

It is good training to fly on standby instruments, but maybe this was not the intention ;-)
Last edited by Knüppelrührer on Tue May 26, 2020 9:15 pm, edited 1 time in total.
User avatar
Knüppelrührer
 
Posts: 234
Joined: Thu Oct 25, 2018 9:06 pm
Version: 2019.1.1
OS: ubuntu 18.04

Re: Cessna C182T with FG1000 glass panel

Postby Hooray » Tue May 26, 2020 6:27 pm

Actually, I am seeing the instrument retained, i.e. the canvas sub tree remains in the property tree
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: 11791
Joined: Tue Mar 25, 2008 8:40 am

Re: Cessna C182T with FG1000 glass panel

Postby stuart » Tue May 26, 2020 9:23 pm

Hooray - How are you creating the display? Is it from the Debug menu (or very similar code). I wasn't expecting people to use that multiple times, so it was creating a new PFD each time. I've now updated the Debug menu to re-use a PFD or MFD if one exists.

Knüppelrührer - which menu item is this? I don't recognize the "Using PFD" menu item. Is it using the C182T? Note that the Debug menu item is completely separate from the FG1000 on the 182.

-Stuart
G-MWLX
User avatar
stuart
Moderator
 
Posts: 1552
Joined: Wed Nov 29, 2006 9:56 am
Location: Edinburgh
Callsign: G-MWLX

Re: Cessna C182T with FG1000 glass panel

Postby Knüppelrührer » Wed May 27, 2020 5:30 am

yes 182T, pure FGaddon install.

"Display PFD" would have been the better term.

Image
User avatar
Knüppelrührer
 
Posts: 234
Joined: Thu Oct 25, 2018 9:06 pm
Version: 2019.1.1
OS: ubuntu 18.04

Re: Cessna C182T with FG1000 glass panel

Postby Hooray » Thu May 28, 2020 3:40 pm

For the record, the delay when instantiating the FG1000 (via the debug menu) is primarily caused by parsexml, i.e. our scripted SVG parser (svg.nas), it causing thousands of context switches between C++ and Nasal (NasalXMLVisitor).

I've been looking at running this in a background thread for-each SVG file, the issue is that our existing Nasal/Canvas APIs are not designed with this in mind - i.e. each parsesvg() invocation expects a handle to the canvas group that is to be updated.

Thus, this might be of interest to Stuart/Richard respectively, to consider wrapping/encapsulating SVG handling so that it can be more easily updated/refined in the future.

For now, what might work is to run each parser asynchronously but only put each created callback in a queue to run the updates sequentially, thoughts ?

Ok, I just changed the parser to use threads for the I/O while moving the manipulating of the group into a callback - and no crashing, the thing is that there is obviously an implicit assumption about the loading order, i.e. the threads haven't yet finished processing all SVG, so that there are missing identifiers - but otherwise, the path seems promising, fgfs remains responsive while it's using separate threads to process each SVG file and create the canvas tree - another option might be to use a temporary SGPropertyNode/props.Node object and merely copy it into the global tree afterwards ... But other than that, file processing/loading is obviously a straightforward candidate for threading

PS: to see for yourself, check out: http://wiki.flightgear.org/Howto:Build_ ... i_4#FG1000
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: 11791
Joined: Tue Mar 25, 2008 8:40 am

Re: Cessna C182T with FG1000 glass panel

Postby legoboyvdlp » Fri May 29, 2020 8:03 pm

Hi Stuart,
Is there any possibility to anti-aliase the display at all?

Image

The lighting might be a little over-bright as well :)

Otherwise, it's definitely very good, thank you, good to have a well-implemented suite of avionics +1

Edit - particularly impressed by the nearest airports list - that's something I made for the Airbus, but quite... inefficiently - might be having a look at that :)

The only other oddity was that when engaging the flight director on the ground, the selected altitude was invalid:
Image
User avatar
legoboyvdlp
 
Posts: 7647
Joined: Sat Jul 26, 2014 1:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: Cessna C182T with FG1000 glass panel

Postby stuart » Tue Jun 09, 2020 4:35 pm

I've split the discussion/investigation into svg parser performance into a new topic here: https://forum.flightgear.org/viewtopic.php?f=71&t=37567

@legoboyvdlp - I'll look at those issues, thanks for reporting them.

-Stuart
G-MWLX
User avatar
stuart
Moderator
 
Posts: 1552
Joined: Wed Nov 29, 2006 9:56 am
Location: Edinburgh
Callsign: G-MWLX

Previous

Return to Aircraft

Who is online

Users browsing this forum: No registered users and 5 guests