Board index FlightGear Development New features

Create an extra window on FG operation interface  Topic is solved

Discussion and requests for new features. Please note that FlightGear developers are volunteers and may or may not be able to consider these requests.

Create an extra window on FG operation interface

Postby umbanana » Sat Jan 04, 2014 4:39 am

Hi all,

I'm not Engligh Mother-tongue, so excuse me please for my mistakes...

I want to create an extra window showing the realtime dynamic curves of flight parameters. eg: Thrust, flight level,etc. But I've got no idea where I should add the scripts in the src v2.10.0. Or are there any other ways to achieve this feature?

Is there any interface for "Plug in" in FG? I didn't find any.

Thx.
umbanana
 
Posts: 29
Joined: Sat Jan 04, 2014 4:20 am

Re: Create an extra window on FG operation interface  

Postby Hooray » Sat Jan 04, 2014 8:05 am

Hi & welcome !

That sounds very interesting.
Most of this can be accomplished by using FlightGear built-in scripting language, which is called Nasal, see: http://wiki.flightgear.org/Nasal
FlightGear Nasal scripts can use the so called "Canvas" system for 2D rendering: http://wiki.flightgear.org/Canvas
This can also be used for plotting and to create graphs, for example this is a trivial example with 5 lines of code:
Image

A more sophisticated example is FGPlot: http://wiki.flightgear.org/FGPlot
Image

So far, none of this requires touching the C++ code or rebuilding FlightGear from source.
And FlightGear also has support for multiple windows - however, while the Canvas system does support several "placement" modes, it does not currently support creating or using additional GUI/osgviewer windows. You would need to get in touch with TheTom to ask him how to implement this, it's a planned feature - but currently not a priority.
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: 11990
Joined: Tue Mar 25, 2008 8:40 am

Re: Create an extra window on FG operation interface

Postby umbanana » Mon Jan 06, 2014 7:48 am

Soooooo many thx!
I've been working on the compiling job with nothing achieved. It's great to know it involves no C++ source codes!
umbanana
 
Posts: 29
Joined: Sat Jan 04, 2014 4:20 am

Re: Create an extra window on FG operation interface

Postby Hooray » Mon Jan 06, 2014 8:18 am

C++ isn't really required for 80-90% of this, but it can obviously be useful, and shouldn't be too difficult if you already know some C++
Admittedly, building FG from source is the most daunting task here. I'd suggest to give the superbuild a try: http://wiki.flightgear.org/Superbuild
On Debian/Ubuntu Linux, you can also use this instead: http://wiki.flightgear.org/Scripted_Com ... ian/Ubuntu

Overall, it would be a good idea to at least learn some git basics, so that you can easily use fgdata and clone the fgplot repository.
I would strongly recommend to look into fgplot and continue with its development, see the wiki for details.
It isn't the most stable code, but it's a solid basis for anything related plotting 2D graphs.

Note that there are also two sub forums that you will find of particular interest, the Nasal sub forum and the Canvas sub forum.
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: 11990
Joined: Tue Mar 25, 2008 8:40 am

Re: Create an extra window on FG operation interface

Postby umbanana » Thu Jan 09, 2014 12:20 pm

Hi Hooray, I've been reading the two sub forums you recommanded, they do help.
I'm quite interested in the second picture you attached in your first reply. It's a pretty nice interface.
Is it possible to get the code in Git?
umbanana
 
Posts: 29
Joined: Sat Jan 04, 2014 4:20 am

Re: Create an extra window on FG operation interface

Postby Hooray » Thu Jan 09, 2014 12:58 pm

yes, it is possible - just read my first response again carefully, and actually check out the links that I posted there: http://wiki.flightgear.org/FGPlot
Where you can find the corresponding fgdata repo: https://gitorious.org/fg/kuifje09s-fgdata

PS: I usually try to post only relevant information, so it's worth spending some time to actually read what I write ... :D
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: 11990
Joined: Tue Mar 25, 2008 8:40 am

Re: Create an extra window on FG operation interface

Postby umbanana » Sun Jan 12, 2014 6:07 am

yes u r right. thx for your patience andI'm really sorry that i always trouble you with some stupid questions...but i've got another one on which i tried to get in touch with kuifje09 got no reply for the moment..
Image
Image
as is shown in the pictures, all the windows and buttons are properly shown but pressing ">" plots nothing...
the codes mentioned may be
Code: Select all
<!-- Buttons for start-stop-quit -->
    <button>
      <legend>&gt;</legend>
      <x>65</x>
      <y>285</y>
      <width>15</width>
      <height>15</height>
      <binding>
        <command>nasal</command>
        <script>
          <![CDATA[
              var a = getprop("/gui/fgplot/running") or 0;
              if(a == 0){
                 setprop("/gui/fgplot/running",1);
                 Do_Plot();
              };]]>
        </script>
      </binding>
    </button>
    <button>
      <legend>-</legend>
      <x>85</x>
      <y>285</y>
      <width>15</width>
      <height>15</height>
      <binding>
        <command>nasal</command>
        <script>setprop("/gui/fgplot/running",0);</script>
      </binding>
    </button>
    <button>
      <legend>X</legend>
      <x>105</x>
      <y>285</y>
      <width>15</width>
      <height>15</height>
      <key>Esc</key>
      <binding>
        <command>nasal</command>
        <script>setprop("/gui/fgplot/running",0);</script>
      </binding>
      <binding>
        <command>dialog-close</command>
      </binding>
    </button>


I didn't make it to clone the repository there's always some errors and i only need some specific files..so i simply copied the codes and created the .xml then put them into the right places. i dont know whether it may create errors.
umbanana
 
Posts: 29
Joined: Sat Jan 04, 2014 4:20 am

Re: Create an extra window on FG operation interface

Postby Hooray » Tue Feb 04, 2014 11:11 pm

is this still open ? If so, please get in touch with kuijfe09 directly, he seems back ...
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: 11990
Joined: Tue Mar 25, 2008 8:40 am

Re: Create an extra window on FG operation interface

Postby umbanana » Tue Feb 11, 2014 1:40 am

Hi Hooray, I've already mailed him and the problem was solved by running FG v 2.12 rather than the lower versions...
Thanks!
umbanana
 
Posts: 29
Joined: Sat Jan 04, 2014 4:20 am


Return to New features

Who is online

Users browsing this forum: No registered users and 1 guest