Board index FlightGear Support Compiling

HOW TO BUILD FLIGHT GEAR, WEBPANEL implementation ?

Building FlightGear from source, and in the need for help?

HOW TO BUILD FLIGHT GEAR, WEBPANEL implementation ?

Postby Kaosiia » Wed Feb 26, 2020 1:01 am

Hello,

I have a couple of questions and any help or direction will be greatly appreciated as i am seriously struggling. I am trying to implement an instrument panel on one of my monitors. I have 2 options - fgpanel or web panel. These are my issues currently.

1. Does anyone here know how to build fgpanel for windows? It seems as though fgpanel was not installed with my flightgear download/installation.

2. Is anyone familiar with the web panel at all? I am utilizing the one for c172p. I have been able to start it up with flight gear by using -httpd=8080.
I am wondering, is it possible to implement the web panel such that immediately flightgear opens, the web panel opens with it. So, both opens simuntaneously. Without me having to click 'Panel in a browser', when flight gear starts.

3. Is it also possible to have the aircraft removed from the screen, such that it is only the outside view showing. i have been able to do that once flight gear opens by clicking 'C' but i wonder if it is possible to implement this before opening flightgear. So, when flightgear does open, it opens up without the aircraft on the screen. Preferably, starting with the aircraft in the air.

Thank you so much and i look forward to any response.
Kaosiia
 
Posts: 33
Joined: Fri Jan 24, 2020 12:06 am

Re: HOW TO BUILD FLIGHT GEAR, WEBPANEL implementation ?

Postby Hooray » Wed Feb 26, 2020 1:39 pm

fgpanel is part of the fgfs source tree, but it can also be easily built separately if you need to, it can be found in $FG_SRC/utils/fgpanel: https://sourceforge.net/p/flightgear/fl ... s/fgpanel/

The build option is called "WITH_FGPANEL": https://sourceforge.net/p/flightgear/fl ... ts.txt#l10

Note that the "web panel" is a different, it's commonly called "Phi", for details refer to the devel list archives and/or the wiki: http://wiki.flightgear.org/Phi

And yes, you should be able to change the default view programmatically, e.g. by setting a property or loading a corresponding XML to change the default view according to what you need
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: 11835
Joined: Tue Mar 25, 2008 8:40 am

Re: HOW TO BUILD FLIGHT GEAR, WEBPANEL implementation ?

Postby ludomotico » Wed Feb 26, 2020 5:48 pm

Kaosiia wrote in Wed Feb 26, 2020 1:01 am:? I am utilizing the one for c172p. I have been able to start it up with flight gear by using -httpd=8080.


The webpanel provided by the c172p will change in the near future. We are now testing a fully interactive panel: instruments, switches and radio stack are operable. Check https://github.com/c172p-team/c172p/issues/1308

I am wondering, is it possible to implement the web panel such that immediately flightgear opens, the web panel opens with it. So, both opens simuntaneously. Without me having to click 'Panel in a browser', when flight gear starts.


I don't like the idea of opening a browser by default: in my set-up, the webpanel is accessed from an iPad, and I don't want a browser on the computer.

Image

In your case, creating a Nasal script that runs the relevant commands to open a browser when the aircraft is ready seems trivial. You can even configure a key for that. Alternatively, you can write a script for your PC to open FlightGear and a browser at the same time .

3. Is it also possible to have the aircraft removed from the screen, such that it is only the outside view showing.


It used to be key "c". For some weird reason, it doesn't work always. For example, in my case, 'c' hides the aircraft if FlightGear is using a single screen, but not if it is on multiscreen.
User avatar
ludomotico
 
Posts: 1098
Joined: Tue Apr 24, 2012 1:01 pm
Version: git
OS: Debian GNU/Linux

Re: HOW TO BUILD FLIGHT GEAR, WEBPANEL implementation ?

Postby Kaosiia » Tue Mar 03, 2020 1:07 am

Thank you guys so much!! The Nasal script you refer too, do you have any idea how to implement that? I haven't heard of a NASA script before.
Kaosiia
 
Posts: 33
Joined: Fri Jan 24, 2020 12:06 am

Re: HOW TO BUILD FLIGHT GEAR, WEBPANEL implementation ?

Postby ludomotico » Tue Mar 03, 2020 12:30 pm

Nasal is the internal scripting language used by FlightGear. You can control nearly any aspect of FlightGear using Nasal.

For example, open FGDATA/keyboard.xml (this file: https://sourceforge.net/p/flightgear/fg ... yboard.xml) This specific file defines the main keys in FlightGear, but be aware an aircraft can overwrite any of these keys. All lines inside a script label are Nasal.

Now look for the definition of key "c" (line 980 in the linked file, yours may be different). Let's change the Nasal script to switch the model off and open a browser each time you press "c":

Code: Select all
 <key n="99">
  <name>c</name>
  <desc>Toggle 3D/2D cockpit</desc>
  <binding>
   <command>nasal</command>
   <script>
        # the default script didn't remove the model if "/sim/allow-toggle-cockpit" is not set
        # for some reason, this property is not set in multiscreen
        # let's remove that check to allow removing the aircraft always.
        # warning: I guess the property "/sim/allow-toggle-cockpit" was defined just for this code, but I can't see its use these days
        setprop("/sim/current-view/internal", !getprop("/sim/current-view/internal"));
        setprop("/sim/view/internal", getprop("/sim/current-view/internal"));
        setprop("/sim/virtual-cockpit", !getprop("/sim/virtual-cockpit"));
        if(getprop("/sim/current-view/internal")) {
          setprop("/sim/current-view/heading-offset-deg", getprop("/sim/current-view/config/heading-offset-deg"));
          setprop("/sim/current-view/pitch-offset-deg", getprop("/sim/current-view/config/pitch-offset-deg"));
        }

       # also, open a browser if the HTTP server is running
       if (getprop("/sim/http/running")) {
           var port = getprop("/sim/http/options/listening-port");
           var url = sprintf("http://localhost:%d/aircraft-dir/WebPanel/c172p-webpanel.html", port);
           fgcommand("open-browser", props.Node.new({ "url": url }));
       }
   </script>
  </binding>
 </key>


This is an example and I've not tested this code. I know for sure that the next version of the C172P will overwrite the "c" key to assign it to the autopilot. You might consider assigning this code to other key, or to a joystick button.
User avatar
ludomotico
 
Posts: 1098
Joined: Tue Apr 24, 2012 1:01 pm
Version: git
OS: Debian GNU/Linux


Return to Compiling

Who is online

Users browsing this forum: No registered users and 1 guest