Board index FlightGear Development Canvas

Canvas ND on another aircraft than Boeing and Airbus

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: Canvas ND on another aircraft than Boeing and Airbus

Postby Gijs » Tue Oct 04, 2016 5:06 pm

I added a setprop yesterday, similar to your print idea. It revealed the range used by searchCmd (me.map.getRange()) is lagging behind with the range set by the pilot. While the latter is used for the display, the map and its range are only updated after the searchCmd is completed.
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9544
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Canvas ND on another aircraft than Boeing and Airbus

Postby Hooray » Wed Oct 05, 2016 8:09 pm

If it's a problem with the whole "layer" (what MapStructure refers to as the "layer-controller", or lcontroller file), the same problem should show up when using the corresponding layer elsewhere - e.g. the map-canvas.xml dialog, does it ?

If it does, you have indeed found a real bug - if in doubt, I would look up the implementation of the map.getRange() method, which would probably be part of api.nas meanwhile (haven't checked) - and that method should have a variable (or setter method) that needs to be called by the layer's update method - if it isn't, you have found the problem.

If in doubt, you can get a backtrace using debug.bt() to get a callchain for the corresponding function.
I willl try to take a look at the code next weekend, and maybe I will find a way to also run the code.
Either way, this should be a minor thing and should not be difficult to fix - it should be all about updating the range and using the proper range for the redraw/update event

EDIT: Just a stab in the dark, but I would compare the lcontroller files between those not working correctly (APT?) and those working correctly - the "fix" should be in the "diff", i.e. some call that isn't made/used by the APT.lcontroller file or done in the wrong order/place. Simply because if other layers work using the same getRange API, it cannot be at the api.nas level, but must be elsewhere - equally, if the problem also shows up for dialogs (no cockpit), it has nothing to do with the cockpit configuration stuff - but is part of the MapStructure machinery

Either way, map-canvas.xml is probably also the best way to easily test this, because it's just a dialog that reloads its Nasal block, unlike the aircraft stuff that isn't easily reloaded.
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: Canvas ND on another aircraft than Boeing and Airbus

Postby Gijs » Fri Oct 07, 2016 2:55 pm

Hooray wrote in Wed Oct 05, 2016 8:09 pm:I would compare the lcontroller files between those not working correctly (APT?) and those working correctly

They all show the same (faulty) behaviour. It's less obvious in some, but I've compared the ranges used in the searchCmds and they're all wrong.

Hooray wrote in Wed Oct 05, 2016 8:09 pm:If it's a problem with the whole "layer" (what MapStructure refers to as the "layer-controller", or lcontroller file), the same problem should show up when using the corresponding layer elsewhere - e.g. the map-canvas.xml dialog, does it ?

When using the dialog, all seems to be correct.

I discovered that the ND layers are updated immediately when the range button is pressed. By adding the following to the affected layers, they are updated once the map range has changed:
Code: Select all
options: {
   range_dependant: 1
},
To prevent the layer from being updated twice, we then have to remove 'toggle_range' from the update_on call. I'll await your feedback before committing this.
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9544
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Canvas ND on another aircraft than Boeing and Airbus

Postby Hooray » Fri Oct 07, 2016 9:44 pm

I would need to look at the code/links to see what you are talking about, I don't think I am familiar with that code, it must have been written by someone else (probably Philosopher) - but what you say sounds sane.
If it fixes an actual problem, I would ask other ND adopters/developers to review/test your changes and then get those committed.
I am not in a good postiion to do any actual testing beyond looking at code/patches and proof-reading suggetions
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: Canvas ND on another aircraft than Boeing and Airbus

Postby clm76 » Sat Oct 08, 2016 5:45 pm

Gijs said :

Code: Select all
options: {
   range_dependant: 1
},


In which file ? Is it in APT.lcontroller like this ?
Code: Select all
var new = func(layer) {
   var m = {
      parents: [__self__],
      options: {range_dependant:1},
      layer: layer,
      map: layer.map,
      listeners: [],
   };
   m.addVisibilityListener();

   return m;
};


I removed also the 'toggle_range from the update_on call in the navdisplay.styles like that :
Code: Select all
            {
               name:'APT',
               isMapStructure:1,
               update_on:['toggle_airports',
                        'toggle_display_mode'],
               predicate: func(nd, layer) {
                     var visible = nd.get_switch('toggle_airports') and
                                nd.in_mode('toggle_display_mode', ['MAP']);
                     layer.group.setVisible( visible );
                     if (visible) {
                        layer.update();
                     }
               }, # end of layer update predicate
               style: {
                  svg_path: 'Nasal/canvas/map/Airbus/Images/airbus_airport.svg',
                  text_offset: [45, 35],
                  label_font_color: [1,1,1],
                  label_font_size: 28
               }
            }, # end of APT layer

But... It doesn't work. Still the same problem ! :(
clm76
 
Posts: 204
Joined: Tue Oct 30, 2012 9:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2020.4.0
OS: Linux Mint 20.2

Re: Canvas ND on another aircraft than Boeing and Airbus

Postby Gijs » Sat Oct 08, 2016 7:47 pm

Almost. Both of the changes had to go to navdisplay.styles ;-)
I've pushed my commit, so you can pull the latest version from Git.
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9544
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Canvas ND on another aircraft than Boeing and Airbus

Postby clm76 » Sun Oct 09, 2016 7:33 am

Yesss... it's ok now ! :D

Many thanks.
clm76
 
Posts: 204
Joined: Tue Oct 30, 2012 9:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2020.4.0
OS: Linux Mint 20.2

Re: Canvas ND on another aircraft than Boeing and Airbus

Postby Hooray » Sun Oct 09, 2016 8:33 am

Yeah, thank you very much.
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: Canvas ND on another aircraft than Boeing and Airbus

Postby Gijs » Sun Oct 09, 2016 9:49 am

Cool! Please do report any other issues you may encounter. I'm sure there are more :-)
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9544
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Canvas ND on another aircraft than Boeing and Airbus

Postby clm76 » Sun Oct 09, 2016 10:16 am

I think we may also add your change to 'Airbus' in Navdisplay.styles... Is it right ?
clm76
 
Posts: 204
Joined: Tue Oct 30, 2012 9:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2020.4.0
OS: Linux Mint 20.2

Re: Canvas ND on another aircraft than Boeing and Airbus

Postby Hooray » Sun Oct 09, 2016 10:27 am

that's a good point, I think some of artix's original work should actually be reviewed to see how much could be reorganized to become better reusable
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: Canvas ND on another aircraft than Boeing and Airbus

Postby Gijs » Sun Oct 09, 2016 1:13 pm

Ah, not being an Airbus pilot myself I missed that one. Committed as well now.
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9544
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Canvas ND on another aircraft than Boeing and Airbus

Postby Hooray » Sun Oct 09, 2016 1:15 pm

For prototyping purposes, i.e. developing new styles for other aircraft, my suggestion would really be to use a PUI/XML dialog and add the boilerplate code from ND.nas into it, so that you can develop the style without having to exit/restart FlightGear:

Image

You could also use io.include() to reload the styles stuff etc - overall, you will have the equivalent of a simple IDE to develop a new style, without having to terminate and restart flightgear, so that you can edit your inkscape artwork, Nasal code etc and can directly view your new ND

PS: whenever someone finds similar issues, it is usually a good idea to see if other aircraft are also affected, and also if the map-canvas.xml dialog (equipment menu) shows the same problem or not, that will make it much easier to review what is going on
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: Canvas ND on another aircraft than Boeing and Airbus

Postby Octal450 » Sun Oct 09, 2016 3:06 pm

I'll be working on an MD-11/717 style ND sometime when I get better at Vector Graphics.

By modifying Gijs PFD, I start to learn.

Are you going to making an Citation Style Canvas Display? It would be nice to add to the CRJs, and other Aircraft.
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: Canvas ND on another aircraft than Boeing and Airbus

Postby Hooray » Sun Oct 09, 2016 3:27 pm

Instead of "learning" Inkscape, you could also just as well get in touch with people who have offered to help with Inkscape artwork (e.g. pommesschranke or Michat) to help you with the artwork, so that you can focus on adapting a corresponding ND style
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

PreviousNext

Return to Canvas

Who is online

Users browsing this forum: No registered users and 4 guests

cron