Board index FlightGear Development Canvas

Plot2D and graph helpers

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: Plot2D and graph helpers

Postby Hooray » Thu Jan 25, 2018 9:17 pm

no, if you created your own artwork and didn't add any "branding", there's no problem
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: Plot2D and graph helpers

Postby Hooray » Fri Jan 26, 2018 12:08 pm

Referring to your commit here: https://sourceforge.net/p/flightgear/fgaddon/3196/

Note that it is generally safer to invoke such code using the call() API, because that way you can do a simple form of exception handling, i.e. a runtime error will not cause the whole dialog/addon to break

To do this in your current code, you would wrap your code in a function like this:

Code: Select all
var source = func() {
call(source, [], nil, nil, var errors=[]);
if (size(errors)) {
print("problem in the code"); # could show a message box instead
} # errors
} # source


Obviously, it would be better if the underlying code makes sure that the function actually returns a valid vector of appropriate values prior to plotting
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: Plot2D and graph helpers

Postby clm76 » Mon Feb 05, 2018 5:58 pm

Hi,

I’m trying to use the oscilloscope to check some properties of the autopilot:
It’s installed as an add-on in the path «/home/chris/.fgfs/fgaddon/Oscilloscope » (I’m with Linux mint 17) and launched with fg 2017.4 as described in the wiki.
The « o » key shows the oscilloscope skin but a nasal error occurs :
Nasal runtime error: Missing arg: propNode
at /home/chris/.fgfs/fgaddon/Oscilloscope/oscilloscope.nas, line 18
called from: /input/keyboard/key[111]/binding, line 1

at this line :
Code: Select all
m.plot1 = plotGraph.setPlotProperty( timeDivs:16, valueDivs:10, color:yellow, timePerDiv:1, resolution:10);

What is wrong ?
clm76
 
Posts: 149
Joined: Tue Oct 30, 2012 8:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2018.3.0
OS: Linux Mint 18.3

Re: Plot2D and graph helpers

Postby rleibner » Tue Feb 06, 2018 2:48 pm

clm76 wrote in Mon Feb 05, 2018 5:58 pm:The « o » key shows the oscilloscope skin but a nasal error occurs :

Weird ...
oscilloscope.nas (line 18), calls to graph.nas (line 36);
Code: Select all
setPlotProperty: func(timeDivs, valueDivs, timePerDiv, source='', color="#0", resolution=5){
 var plot = plotProperty.new(me.group,me.view,source,timeDivs,valueDivs,timePerDiv,color,resolution);
},
and there is no propNode argument here !

Are you sure you have the latest version ( revision 3211, uploaded Jan 30) ?
Rodolfo
*************************
Non-shared knowledge is lost knowledge
User avatar
rleibner
 
Posts: 246
Joined: Fri May 19, 2017 7:17 pm
Location: Uruguay - SUMU
Callsign: CX-BEX
Version: 2180.4.0
OS: Ubuntu 18.04

Re: Plot2D and graph helpers

Postby clm76 » Wed Feb 07, 2018 9:23 am

Are you sure you have the latest version ( revision 3211, uploaded Jan 30) ?

Yes, it's the latest version downloaded from svn (3201 not 3211).
clm76
 
Posts: 149
Joined: Tue Oct 30, 2012 8:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2018.3.0
OS: Linux Mint 18.3

Re: Plot2D and graph helpers

Postby wkitty42 » Wed Feb 07, 2018 2:06 pm

this is confusing... it looks like you guys are talking about SVN revisions... i got the updated oscilloscope.nas and graph.nas when my system updated to svn 3205 on 2018 Feb 2... today's updates, 2018 Feb 7, brought me svn revision 3211...

the version inside addon-metadata.xml says it is version 0.0.1... perhaps it would be better to update the metadata version and use that to go by? any time an update is put up on svn, update the metadata version number first and then upload it...

FWIW: i just loaded the oscilloscope for the first time and it seems ok... no error messages that i can see on my console or log file... i just don't know how to use it right now :)
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5574
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: Plot2D and graph helpers

Postby rleibner » Wed Feb 07, 2018 3:09 pm

clm76 wrote in Wed Feb 07, 2018 9:23 am:Yes, it's the latest version downloaded from svn (3201 not 3211).
That's the problem: please update form 3211 https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/Addons/Oscilloscope/

wkitty42 wrote in Wed Feb 07, 2018 2:06 pm:... perhaps it would be better to update the metadata version and use that to go by? any time an update is put up on svn, update the metadata version number first and then upload it...
You are right, wkitty42. Will do that.
wkitty42 wrote in Wed Feb 07, 2018 2:06 pm:i just don't know how to use it right now :)
See its wiki page
Rodolfo
*************************
Non-shared knowledge is lost knowledge
User avatar
rleibner
 
Posts: 246
Joined: Fri May 19, 2017 7:17 pm
Location: Uruguay - SUMU
Callsign: CX-BEX
Version: 2180.4.0
OS: Ubuntu 18.04

Re: Plot2D and graph helpers

Postby clm76 » Wed Feb 07, 2018 5:56 pm

The link https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/Addons/Oscilloscope/ returns the version 3201 as you can see on this picture:

Image

The nasal error is not when downloading, but by pushing the "o" button.
clm76
 
Posts: 149
Joined: Tue Oct 30, 2012 8:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2018.3.0
OS: Linux Mint 18.3

Re: Plot2D and graph helpers

Postby rleibner » Wed Feb 07, 2018 7:44 pm

I do not understand, how the same link opens 2 different pages to you and me ? :?:
Image
can someone enlighten me?
Rodolfo
*************************
Non-shared knowledge is lost knowledge
User avatar
rleibner
 
Posts: 246
Joined: Fri May 19, 2017 7:17 pm
Location: Uruguay - SUMU
Callsign: CX-BEX
Version: 2180.4.0
OS: Ubuntu 18.04

Re: Plot2D and graph helpers

Postby rleibner » Wed Feb 07, 2018 11:32 pm

Hi clm76,

In the meantime, you can download it as a tar.gz from here.
Rodolfo
*************************
Non-shared knowledge is lost knowledge
User avatar
rleibner
 
Posts: 246
Joined: Fri May 19, 2017 7:17 pm
Location: Uruguay - SUMU
Callsign: CX-BEX
Version: 2180.4.0
OS: Ubuntu 18.04

Re: Plot2D and graph helpers

Postby wkitty42 » Thu Feb 08, 2018 6:16 am

rleibner wrote in Wed Feb 07, 2018 7:44 pm:I do not understand, how the same link opens 2 different pages to you and me ? :?:

look at his image... the link in the browser address bar is different than the one posted... when i use the posted one (with HEAD in it), i get the same page as you show in your image... however, if i use the one in his image's browser address bar, i get his image... i'll list them here on top of each other for comparison ;)
https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/Addons/Oscilloscope/
https://sourceforge.net/p/flightgear/fgaddon/3211/log/?path=/trunk/Addons/Oscilloscope/
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5574
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: Plot2D and graph helpers

Postby clm76 » Thu Feb 08, 2018 8:07 am

On my image, it's the history version (History in the menu bar, after "Download Snapshot") where we can see that the latest version in svn is 3201.
I downloaded the tar.gz version which is different of the svn version, but ... I get the same error of propNode in "oscilloscope.nas" line 18, when pushing the "o" button.
clm76
 
Posts: 149
Joined: Tue Oct 30, 2012 8:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2018.3.0
OS: Linux Mint 18.3

Re: Plot2D and graph helpers

Postby rominet » Thu Feb 08, 2018 8:36 am

Hi,

Dunno about the propNode problem, but for the rest, I believe you (clm76 and rleibner) may be confusing the whole FGAddon repo revision (presumably 3211 in all recent messages here) with:
  • the revision displayed left of each file in a given dir (e.g., 3183 for Oscilloscope/README.first in rleibner's message), i.e. the last FGAddon revision where each particular file in a given dir was modified;
  • the latest FGAddon revisions where a particular directory received changes (as displayed for the Oscilloscope dir in clm76's message: 3201, 3196, 3195, etc.).
HTH

Edit: I don't see the “Nasal runtime error: Missing arg: propNode” message reported here either.
rominet
 
Posts: 557
Joined: Sat Nov 01, 2014 1:33 pm
Callsign: F-KATS
Version: Git next
OS: Debian GNU/Linux

Re: Plot2D and graph helpers

Postby wkitty42 » Thu Feb 08, 2018 1:14 pm

i'm seriously starting to wonder if clm76's FG is "old" and doesn't contain something needed for the oscilloscope... the sidebar of his posts says he's running 2017.4.0 but when did he update to the latest commits and build a new set of binaries?

FWIW: i'm building and running with the following commits...
Code: Select all
********** 2018-02-07 06:58:04 -0500 **********
********** Total elapsed update and compile time is 0 days 0 hours 17 minutes 41 seconds **********

PLib:    a542b8a03f8de1fe844af6ab4734b64d11e272e9
OSG 3.4: 18721039c5f22925ff4239b6f5e152296312c836
Simgear: ed5372f43918cb03198e98823b0c57420c5b5d61
FGFS:    cb6b267430ea9071e99ee8883a7549cab3442771
FGData:  a2b17b4085f3d8aa60c3583777c4d81de7482c3b
FGAddon: r3211 | jam007 | 2018-02-04 14:04:03 -0500 (Sun, 04 Feb 2018)
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5574
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: Plot2D and graph helpers

Postby rleibner » Thu Feb 08, 2018 4:13 pm

About the propNode problem, I suggest you (clm76) to open the graph.nas file and search the setPlotProperty: func(... line.
As said, mine reads:
rleibner wrote in Tue Feb 06, 2018 2:48 pm:oscilloscope.nas (line 18), calls to graph.nas (line 36);
setPlotProperty: func(timeDivs, valueDivs, timePerDiv, source='', color="#0", resolution=5){
var plot = plotProperty.new(me.group,me.view,source,timeDivs,valueDivs,timePerDiv,color,resolution);
},

and there is no propNode argument here !
We must find where the mysterious error is generated.

EDIT: may be you have another canvas.graph ?
note that the main.nas reads:
...
if (canvas['graph']==nil) io.load_nasal( root ~ '/graph.nas', "canvas" );
...
Rodolfo
*************************
Non-shared knowledge is lost knowledge
User avatar
rleibner
 
Posts: 246
Joined: Fri May 19, 2017 7:17 pm
Location: Uruguay - SUMU
Callsign: CX-BEX
Version: 2180.4.0
OS: Ubuntu 18.04

PreviousNext

Return to Canvas

Who is online

Users browsing this forum: No registered users and 6 guests