Board index FlightGear Development Canvas

How to display Airport Chart?

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.

Re: How to display Airport Chart?

Postby Hooray » Wed Nov 27, 2013 7:47 pm

For now, I guess it should suffice to get the ND stuff committed to fgdata, which can be handled by Gijs & Hyde, because they're aircraft developers and also familiar with Nasal.
And it would allow them to continue working on the ND code independently.

Afterwards, I could help looking into MapStructure.nas - if you consider it feasible to finish it in time, which would then probably also involve porting our existing *.draw/*.layer files.
Ultimately, we must not forget that the same code will be used by dialogs like the airport selection dialog, so we also need to make sure that there's no breakage introduced by having a half-baked shared backend in place.
.
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: 11326
Joined: Tue Mar 25, 2008 8:40 am

Re: How to display Airport Chart?

Postby Hooray » Wed Nov 27, 2013 10:40 pm

Philosopher: My guess was correct: your MapStructure framework works properly once the corresponding Canvas::Map properties are set (lat/lon/range):

Image
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: 11326
Joined: Tue Mar 25, 2008 8:40 am

Re: How to display Airport Chart?

Postby Hooray » Wed Nov 27, 2013 10:48 pm

pushed a fix, you never saved a handle to the map layer (group) itself, and instead directly added a new child group - so I changed the constructor to save a handle separately and use that to set ref lat/lon/range: https://gitorious.org/fg/hoorays-fgdata ... ae7e9bf913
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: 11326
Joined: Tue Mar 25, 2008 8:40 am

Re: How to display Airport Chart?

Postby Philosopher » Wed Nov 27, 2013 11:02 pm

Yep, did that locally too, will look at what happens with --rebase ;). Thanks for the help, it seems to work fine.

The center of the map seems to be (0,0), though? Top-left corner?
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: How to display Airport Chart?

Postby Hooray » Wed Nov 27, 2013 11:14 pm

Philosopher wrote in Wed Nov 27, 2013 11:02 pm:The center of the map seems to be (0,0), though? Top-left corner?


right, something's still not quite right there - need to see what's going on and compare it to other (working) maps, i.e. the airport selection dialog or the ND in the 747/777 - you can use two property browser instances to compare each map subtree side by side, that's how I found out about those missing properties, too.

But overall, it really does look promising, I'm not too worried about the Nasal side of things now - I just hope our C++ guys find some time to help optimize things a little, especially those positioned delta queries would be useful to have in 3.0 and if we really want to replace the built-in map widget, some more C++ hooks would also be good.

EDIT: it seems like a simple translation issue, probably because of your viewport vs. texture dimensions - look at the "tf" properties in the airport-selection or ND canvas for comparison.
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: 11326
Joined: Tue Mar 25, 2008 8:40 am

Re: How to display Airport Chart?

Postby Hooray » Thu Nov 28, 2013 3:24 pm

Another update, Hyde just finished implementing support for a 2nd independent ND on the 777-200ER:
Image

Again, thanks for doing this Hyde, I realize it probably isn't important to you guys but this will really help me when continuing with the generalization stuff, so it's really appreciated!
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: 11326
Joined: Tue Mar 25, 2008 8:40 am

Re: How to display Airport Chart?

Postby Hooray » Thu Nov 28, 2013 4:56 pm

TheTom wrote in Tue Nov 12, 2013 6:12 pm:If time allows I will also look into the array diff problem. Which fgdata clone should I use for the current state of the ND display?


We all know about the release plan and the upcoming code freeze, and that everybody is busy with different things - so if supporting delta-positioned queries at the C++ level should pose a problem, we could also provide a simple Nasal extension function instead, which would merely diff() two vectors - Philosopher's algo works properly, but seems slow on less powerful computers (not so much here), my frame rate drops by about 10 fps when doing a delta-query in Nasal space (100 nm range): https://gitorious.org/fg/hoorays-fgdata ... 6fb8177536
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: 11326
Joined: Tue Mar 25, 2008 8:40 am

Re: How to display Airport Chart?

Postby TheTom » Thu Nov 28, 2013 4:59 pm

This addition does not seem to be too complicated. Maybe you can show me a short example of how it is done now and how you would like to have it (signature/description of the exposed functions).
TheTom
 
Posts: 321
Joined: Sun Oct 09, 2011 10:20 am

Re: How to display Airport Chart?

Postby Hooray » Thu Nov 28, 2013 5:01 pm

TheTom wrote in Thu Nov 28, 2013 4:59 pm:This addition does not seem to be too complicated. Maybe you can show me a short example of how it is done now and how you would like to have it (signature/description of the exposed functions).


https://gitorious.org/fg/hoorays-fgdata ... o.nas#L327

(run the .test() method to see it working)
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: 11326
Joined: Tue Mar 25, 2008 8:40 am

Re: How to display Airport Chart?

Postby Philosopher » Thu Nov 28, 2013 5:06 pm

Currently I just added it to geo.nas (positioned.nas would be a better place, though): https://gitorious.org/fg/hoorays-fgdata ... o.nas#L327

It's only used in one place, so changing it isn't hard: https://gitorious.org/fg/hoorays-fgdata ... e.nas#L219

Beware that I used the _equals member here, https://gitorious.org/fg/hoorays-fgdata ... e.nas#L237, but that can be changed to embedding it (a.id == b.id).

I'm just wondering if it's possible not to run a whole search again? I think that's what takes the most time, as vector diffs shouldn't eat up much time, if at all.
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: How to display Airport Chart?

Postby Hooray » Thu Nov 28, 2013 5:11 pm

I think we talked about that a couple of weeks ago, i.e. reducing the workload by introducing a min-range property, otherwise it is already a spatial search, so should be pretty fast in C++ space.

EDIT: Here's another update, this time running purely Philosopher's new MapStructure code, but in an old PUI/XML dialog with an embedded Canvas section (performance is ~44fps with ~35 ms here, even when flying at 3000 kts groundspeed), this requires about 5 lines of Nasal code now, thanks to Philosopher's MapStructure framework:

Image

This goes to show that our *.draw/*.symbol implementations contain hard-coded assumptions about the resolution of the canvas - and will need some LOD support once the parent canvas has different dimensions. Otherwise, it's perfectly usable - and I suggested to move testing code into this dialog now, which would provide a real use-case, while also allowing us to incrementally reimplement the MapWidget code.
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: 11326
Joined: Tue Mar 25, 2008 8:40 am

Re: How to display Airport Chart?

Postby Hooray » Sun Dec 01, 2013 5:00 pm

Gijs committed the NavDisplay part of this now, thank you!

Also, some people reported lag, that will undoubtedly improve once MapStructure is adopted and once Tom/Zakalawe provided a better positioned query API - but in the meantime it may help to use a less aggressive timer, I suggest to change the ND constructor/newMFD method, so that this can be configured by the aircraft developer, look for the maketimer() call in navdisplay.mfd and turn it into a variable - add the variable to the method, and default it to the current value - that way, you can override it in your ND.nas file

In the long run, the right thing to do, would updating different elements using smarter heuristics, i.e. not just at frame rate - MapStructure will help with that, but isn't yet quite finished... but if in doubt: it should be safe to commit MapStructure changes even during the code freeze because it only affects the aircraft using it, i.e. 744 or possibly 777, as long as the aircraft developers are okay with it, as per Torsten's policy regarding code freeze vs. aircraft changes (see lessons learned).

I hope that Hyde will find some time to commit his own 777 changes, so that we have a 2nd aircraft using the framework, which is good to ensure that things are working properly. Otherwise, I am handing navdisplay.mfd over to the two of you for the time being, and hope that you find some time to discuss missing features - feel free to add lots of comments to the file, which will help me when looking at it again.

If you don't know where/how to add something, just use the update() method for now, and I will fix things later on. Regarding the shared/common SVG file, I suggest to introduce a prefix for each manufacturer/type, so that aircraft developers can all use a single file and look up the required elements - that would allow us to use it for Airbus etc too - no need to reinvent the wheel, just add custom/special stuff to it if required.

PS: did you change anything else ?
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: 11326
Joined: Tue Mar 25, 2008 8:40 am

Re: How to display Airport Chart?

Postby Hooray » Mon Dec 02, 2013 12:51 am

@Philosopher: I couldn't find my original caching experiments, so I started from scratch - here's a quick hack, I think we can extend this, but I'm not getting any bounding box info for each group I'm adding at the moment, will need to ask Tom:

Image
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: 11326
Joined: Tue Mar 25, 2008 8:40 am

Another update

Postby Hooray » Wed Dec 04, 2013 10:50 pm

Gijs wrote:Hi all,

I've just pushed my first set of improvements to Git. This includes, amongst other features, heading and track modes. Currently only magnetic, but true is coming. It's nice to play around with the display mode while flying with a 40 kt crosswind (see the difference between track and heading). Another nice feature is the wxradar; which only works with advanced weather thunderstorms for the moment. See the commit message for all changes:

https://gitorious.org/fg/fgdata/commit/ ... ad553ce9ac
Code: Select all
- move SVG to Canvas directory
- -add basic wxradar
- differentiate between track and heading
- improve altitude arc
- add range arcs
- display correct ETA for next waypoint


Enjoy!
Gijs


Image
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: 11326
Joined: Tue Mar 25, 2008 8:40 am

Re: How to display Airport Chart?

Postby TheTom » Sun Dec 08, 2013 7:06 pm

Great to see how the Canvas boosts the development of glass cockpits! :-)

I've just added positioned.diff to Nasal which allows creating diffs between positioned lists. On my computer this improves the time of running geo.PositionedSearch.test() from ~24s to ~0.17s.
TheTom
 
Posts: 321
Joined: Sun Oct 09, 2011 10:20 am

PreviousNext

Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest