Board index FlightGear Development Canvas

Custom Features in NavDisplay

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.

Custom Features in NavDisplay

Postby tikibar » Tue Nov 04, 2014 9:08 am

I got the Canvas ND set up on the 747-8, and it seems to be working. It looks great. Now I have a more advanced thing I want to do with it.

I'm working on a military variant of the 747-8, which uses a TACAN in addition to the regular NAV radios. Since this is, at this point, a strictly fictional aircraft, I don't know that it would be appropriate to put the TACAN display information in the centralized navdisplay svg and nasal files. What I would like to do is somehow append the extra features to the nd.styles from the ND.nas file that is specific to the 747-8 and have them use objects contained in a separate svg file. Would that work? I think nasal is flexible enough to append additional hashes to the features vector, but is it possible to pull from more than one svg file?
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 515
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: Custom Features in NavDisplay

Postby Hooray » Tue Nov 04, 2014 12:31 pm

That should be possible - depending on your requirements (having just TCAS info vs. also full TACAN symbology on a map layer), the simplest option might be adding it as a conventional feature to the styles hash, and adding another conditional check to the "predicate" field to ensure that this is only ever used if a certain property like "show-tacan-info" is set - that way, other aircraft won't be affected by your changes, while you could still commit everything the usual way, without having to restructure the code in any major way.

Equally, the TFC layer could be adapted for TACAN support in a similar way by checking some custom property and only using the TACAN version if that property is set.

Unless Gijs or Hyde actually do object, I'd add things to the existing SVG/nasal files - after all, we are hoping to grow a library of useful features/layers - and a TACAN-ND could be useful on other aircraft eventually - I mean it's not entirely fictional like some kind of Star Trek display - and it will be optional, too - so, why not? :)

The main instructions for this are at: http://wiki.flightgear.org/NavDisplay#A ... w_features
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: 11427
Joined: Tue Mar 25, 2008 8:40 am

Re: Custom Features in NavDisplay

Postby tikibar » Tue Nov 11, 2014 8:41 am

I went with the first idea: setting a predicate conditional to keep the TACAN fully optional and putting it into the main navdisplay.styles and boeingND.svg. It looks like this:

Image

In order to use the TACAN, you would have to set /sim/model/enable-canvas-tacan-display to true. Otherwise it's as if it wasn't there (double checked that with the default 777). Next step is to incorporate it into fgdata, if there are no objections. I tried to open a merge request, but gitorious returns a 504 gateway timeout error every time. So instead I zipped up the two files and put them here: https://dl.dropboxusercontent.com/u/266 ... Dtacan.zip
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 515
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: Custom Features in NavDisplay

Postby Gijs » Tue Nov 11, 2014 8:45 am

Looks good! I'd prefer to have the toggle property under the instrument's tree tough (next to the other options like display type), but that'll be easy to fix. I'll have a look at it this evening. Thanks!
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9386
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Custom Features in NavDisplay

Postby tikibar » Tue Nov 11, 2014 9:08 am

Hi Gijs,
Thanks for taking a look at it. It's got a toggle property too. The enable prop is there just to make sure the TACAN stays hidden on aircraft that aren't using it. It's more of a "tacan exists" prop as opposed to a "tacan is on." It needs both to work. I'm not overly attached to the name or location of the property.
Cheers,
John
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 515
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: Custom Features in NavDisplay

Postby Gijs » Tue Nov 11, 2014 9:27 am

I was referring to what you call "tacan exists", it may be instrument dependant etc so I'll place it minder the instrumenten tree ;-)
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9386
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Custom Features in NavDisplay

Postby Hooray » Tue Nov 11, 2014 11:57 am

agreed, it makes sense to introduce a member variable at the scope of the instrument INSTANCE, and not use some global state - e.g. imagine having 10 different NDs on 5 different aircraft - those should all have their own state obviously
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: 11427
Joined: Tue Mar 25, 2008 8:40 am

Re: Custom Features in NavDisplay

Postby Gijs » Tue Nov 11, 2014 7:26 pm

Hi John

do you've got an aircraft for testing the TACAN? It doesn't seem to work on my 744 :-)
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9386
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Custom Features in NavDisplay

Postby tikibar » Tue Nov 11, 2014 8:20 pm

I do. The military variant of the 747-8 is included in this package: https://github.com/dogsaysmoo/747-8i/ar ... canvas.zip. Start the 747-8G4 variant (that's the one with the TACAN. The -8i and -8F don't have it). It's set up to use /sim/model/enable-canvas-tacan-display as the "<tacan exists>" prop. I set that to true in the 747-8G4-set.xml. It also needs a toggle_tacan switch in the Models/Cockpit/ND.nas script to turn it on and off, and it won't work without having a TACAN instrument defined in Systems/instrumentation.xml.
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 515
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: Custom Features in NavDisplay

Postby tikibar » Sun May 17, 2015 2:09 pm

This thread has been asleep for a while, but I've recently revisited the TACAN display on the canvas ND. I'm working on a C-32 variant for the 757-200, which will also use the canvas ND and will need the TACAN.

I've changed the predicate setup so, instead of checking an "enable" type property, it simply checks the switches hash to see if 'toggle_tacan' exists (!= nil). If it doesn't, it skips all the TACAN-related stuff in navdisplay.styles. In this way, adding the TACAN won't affect any aircraft that don't use it (777, 744, 748, etc).

There's a pending merge request on fgdata with these changes. I hope we can get them added in time for the feature freeze.

Cheers,
John
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 515
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: Custom Features in NavDisplay

Postby Philosopher » Sun May 17, 2015 3:14 pm

As I said in the other topic, I'll try and review changes if you bug me enough ;).
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: Custom Features in NavDisplay

Postby Gijs » Sun May 17, 2015 3:17 pm

Excellent! Sorry for not handling this any earlier, but if Philosopher doesn't beat me to it, I'll have a look this week.
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9386
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10


Return to Canvas

Who is online

Users browsing this forum: Google [Bot] and 1 guest