Board index FlightGear Development

Announcing FFGo: a new FlightGear launcher

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

Announcing FFGo: a new FlightGear launcher

Postby rominet » Tue Aug 04, 2015 4:47 pm

Hello,

I am pleased to announce a new FlightGear launcher called FFGo. As the name indicates, it is an improved version of FGo! (technically, a fork of FGo!).

Before someone asks, the reason for forking is not that I dislike FGo! or its author, quite the contrary actually; but after having substantial developments done and working for more than 6 months (some of which by Robert, by the way), there is still no FGo! release offering them to users and I don't manage to contact FGo!'s upstream author anymore. I just hope nothing bad happened to him. Therefore, in order to allow other people to benefit from the new features, I decided to release the code and change the name so as not to spread confusion among users.

That being said, we can start with the real thing. FFGo's home page is at http://frougon.net/projects/FFGo/ and the code is maintained in this Git repository. The license is the same as for FGo!: WTFPL version 2.

Contrary to FGo! up to 1.5.5, it requires Python 3.4 or later, not Python 2. Because of this and the new dependency on CondConfigParser, the software requirements are a bit different from those of FGo!, but this is all explained on the home page, the FlightGear wiki and the docs/INSTALL folder of release tarballs or zip files (Git version of docs/INSTALL/INSTALL_en here).

The main user-visible improvements in FFGo 1.0.0 (old!), compared to FGo! 1.5.5, were:
  • cross-platform—known to work on Linux and Windows, should work on MacOS X too;
  • works with Python 3;
  • doesn't have the annoying “FlightGear is running” little window that, at least in my setup, had a nasty tendency to stay on top when switching between workspaces to look at the MPmap or a ground chart;
  • related to this change: you can edit your configuration while FlightGear is running (although some things in the interface won't react in order to save a little bit of performance for FlightGear);
  • conditional configuration as illustrated below and fully explained at http://frougon.net/projects/FFGo/doc/README-conditional-config/;
  • Command Window and Output Window (visible on the screenshots displayed on the home page);
  • displays the fgfs exit status or killing signal in the main window (so you can immediately tell if FlightGear ended normally or because of a segfault :wink:);
  • the Reload config file button (known as Reset in FGo!) works correctly (in Debian testing/unstable, it also works correctly, but only because I applied a patch Robert sent me by private mail); this is very useful to edit the configuration in a real text editor without having to quit and restart FGo! on every change;
  • a few convenient keyboard shortcuts;
  • it is maintained in a Git repository.
The above list is old. For a more up-to-date list of features (+ screenshots and installation instructions), see FFGo on the FlightGear wiki, in particular the Features section.

A few examples of what you can do with the new conditional configuration feature:

  1. You can pass arbitrary arguments to FlightGear (fgfs) based on simple or complex conditions. In particular, with --prop=..., you may set arbitrary FlightGear properties depending on some conditions of your choice. For instance, I have a custom binding for the mouse wheel to control the throttle, and since the helicopter I usually fly is much more throttle-sensitive than most planes, I have set up FFGo's configuration to conditionally pass a property that modifies my mouse wheel binding's behavior when I am flying a helicopter. This is done like this in FFGo's config file (~/.ffgo/config on non-Windows systems, otherwise %APPDATA%/FFGo/config):
    Code: Select all
    { using_heli = aircraft in \
        ["alouette2", "alouette2F", "Alouette-III_sc", "bo105",
         "ec130b4", "ec135p2", "M-XE", "s55", "s76c", "uh1", "uh60",
         "rah-66"]
      # 'using_heli' is now a boolean (True or False)
    }

    # You can put your standard (unconditional) fgfs options here:
    # [...]
    #

    [ using_heli ]
    --prop:/frougon/initial-mouse-wheel-throttle-step=0.004

    # Other conditional sections:
    # [...]

  2. A second example could be the following: automatic setting of navigation instruments based on some condition such as “starting airport is...” or “instruments == "whatever"”, where 'instruments' is a variable defined at the top of the config. In the simplest case, that could be something like this:
    Code: Select all
    [ airport == "MHTG" ] # This is Tegucigalpa in Honduras
    --nav1=122:112.3 # Toncontin VOR (TNT): frequency 112.3 MHz, radial 122°

    With this simple configuration, every time you start FFGo at MHTG, it will automatically set up your NAV1 frequency and the appropriate radial for the runway 02 approach.

    If you want this to also work when you start from elsewhere, you could do something like this:
    Code: Select all
    { # Use another value if you don't want the particular instruments
      # settings to be applied.
      instruments = "MHTG"
    }

    [ instruments == "MHTG" or ((not instruments) and airport == "MHTG") ]
    --nav1=122:112.3 # Toncontin VOR (TNT)

    This config performs the particular instruments setting if:
    • either the 'instruments' variable is set to "MHTG";
    • or it is false (such as the boolean False or the empty string "") and the start airport is "MHTG".
    Note: in the above condition, the parentheses could all be omitted because of the relative priorities of boolean operators.

    Using properties, you can even define both the selected and standby frequencies of the NAV and ADF instruments. For instance:
    Code: Select all
    # LOWI approach from the west
    [ instruments == "LOWI-appW" or custom_start_pos == "LOWI-appW" ]
    --prop:/instrumentation/nav/frequencies/selected-mhz=109.70 # OEJ
    --prop:/instrumentation/nav/radials/selected-deg=67
    --prop:/instrumentation/nav/frequencies/standby-mhz=111.1   # OEV
    --prop:/instrumentation/adf/frequencies/selected-khz=303 # RATTENBERG (RTT)
    --prop:/instrumentation/adf[1]/frequencies/selected-khz=413 # KÜHTAI (KTI)
    --prop:/instrumentation/adf[1]/frequencies/standby-khz=313 # ABSAM (AB)
    --dme=nav1

    This is convenient when approaching LOWI (Innsbruck airport) from the west, because it sets up the OEJ VOR on NAV1 and the KÜHTAI NDB on ADF2 which can be watched simultaneously on the same screen with the 777. And if you need a go-around, you just have to switch the active and standby frequencies:
    • on NAV1 to set the OEV VOR;
    • on ADF2 to set the ABSAM NDB.
    And you still have the RATTENBERG NDB available on ADF1 should you need it.
  3. In combination with the previous example, you could easily practice the LOWI approach from the west with something like:
    Code: Select all
    [ custom_start_pos == "LOWI-appW" ] # Approach from the west
    --fix=KTI08
    --altitude=13000
    --heading=137
    --vc=120

    This would make you automatically start in the air at 13000 ft (for planes that support in-air starting such as SenecaII, not 777 unfortunately), at the given place and airspeed, provided you have set the 'custom_start_pos' variable to "LOWI-appW". This last variable setting can be done as for 'instruments' above, at the very top of the configuration:
    Code: Select all
    { custom_start_pos = "LOWI-appW" }

    (the brace-delimited section for custom variable definitions must come first in the config, or be absent)
  4. The last example I am going to give here allows one to define custom start positions that may depend on the chosen aircraft. This is in some way similar to the type="cargo/gate/ga/..." metadata that can be defined in groundnets (http://osdir.com/ml/flightgear-sim/2015-07/msg00046.html) but it can be done directly in the FFGo config instead of a groundnet file. Example:
    Code: Select all
    { custom_start_pos = "parking"
      # Some planes that use boarding gates
      gate_class = aircraft in ["777-200ER", "A320neo", "A330-203", "CRJ700"]
      # General aviation
      ga_class = aircraft in \
        ["c172p", "SenecaII", "Cub", "dr400-dauphin", "dhc6", "Dragonfly"]
    }

    # Toncontin Intl (Tegucigalpa, Honduras)
    [ custom_start_pos == "parking" and airport == "MHTG" and gate_class ]
    --lat=14.06054
    --lon=-87.21878
    --heading=288

    [ custom_start_pos == "parking" and airport == "MHTG" and ga_class ]
    --lat=14.05552
    --lon=-87.21387
    --heading=265

    With such a configuration, assuming you have set 'custom_start_pos' to the string "parking" in the optional brace-delimited section at the top of your config (as shown above), whenever you start at MHTG, FFGo will place your plane at an appropriate place in the airport depending on its type. Very convenient for ATC sessions!

    The advantage of this method compared to defining parking positions in groundnet files is that it is very easy to set up using the magical vi-like ': Y m' shortcut in FlightGear (which prints a Google Maps link on the terminal), and it works right now. You can extend the system for helicopters/helipads with a heli_class, etc. The disadvantages are that:
    • it is FFGo-specific and not automatically shared with other people, as opposed to data uploaded on the TerraSync servers;
    • it doesn't scale very well (if you copy/paste my config, you are going to start at the exact same location as me, unless I define a different one in the meantime);
    • changing the parking position at a given airport using this method is not as convenient as with the standard (FGo!/FFGo)+FlightGear mechanism (using --parkpos) when a decent groundnet has already been defined.
There we are. I hope these little examples have somehow whetted your appetite and that you'll want to try FFGo out. :wink:

Note: currently, only the English translation is up-to-date. The other translations are inherited from FGo! 1.5.5, so translators won't have to start from scratch. If you feel like contributing in this area, you're very welcome. The relevant info is in docs/INFORMATION_FOR_TRANSLATORS in release tarballs and in the Git repository.

Don't hesitate to ask here or by e-mail if you encounter any problem. My e-mail address can be found in FFGo's docs/README/README_en file, for instance; you can also send real e-mails directly from this forum (cf. the envelope icon).

Happy flying!

Edit: link to the new home page (changed on April 30, 2016) and to FFGo's page on the FlightGear wiki.
Last edited by rominet on Sat Apr 30, 2016 10:17 pm, edited 1 time in total.
rominet
 
Posts: 468
Joined: Sat Nov 01, 2014 1:33 pm
Callsign: F-KATS
Version: Git next
OS: Debian GNU/Linux

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Sun Aug 16, 2015 5:01 pm

I have uploaded FFGo 1.0.0b3 which mostly fixes a bug when the optional Pillow dependency isn't available.

The current development version (not yet in the Git repo) has setuptools-based packaging and can be installed/upgraded/removed via pip, in a virtual environment if you wish. Drop me a message if you are interested.
rominet
 
Posts: 468
Joined: Sat Nov 01, 2014 1:33 pm
Callsign: F-KATS
Version: Git next
OS: Debian GNU/Linux

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Fri Aug 21, 2015 10:41 am

As promised, I have uploaded FFGo 1.0.0 with setuptools-based packaging. This means that, if you have a “working pip setup” as explained in the docs/INSTALL/INSTALL_en file, you can install it with a simple:
Code: Select all
pip install FFGo

command ('pip install ffgo' should work just the same). If you want to have aircraft thumbnails displayed in FFGo, you should add:
Code: Select all
pip install Pillow

but this one may fail if you don't have the required software installed. However, it is completely optional for FFGo.

To see if there is a new version available (and also list other outdated packages at the same time), you can do:
Code: Select all
pip list --outdated

To upgrade FFGo:
Code: Select all
pip install -U FFGo

(you may replace -U with --upgrade)

To remove FFGo:
Code: Select all
pip uninstall FFGo


This should work on any platform where Python works, thus including Linux, Windows and MacOS X. In order for FFGo to run correctly on MacOS X, you may need to consult this page, though. But I haven't been able to try it on this OS, so please report!

This release fixes a bug on the Windows platform, however I haven't had the chance to try it there either. Please report, otherwise only Linux will be well-supported.

If you don't want to set up pip, it is also possible to run the program directly from an unpacked release tarball or zip file (using the ffgo-launcher.py script instead of the ffgo executable which is created during standard pip-based installations). However, you'll still have to install the dependencies (essentially CondConfigParser), which is often easier with pip...

This is all explained on the FFGo home page and in the docs/INSTALL/INSTALL_en file shipped in any release tarball or zip file.

Note for Windows users:

Setting up pip on Windows is a breeze: you just have to make sure the corresponding option is checked in the Python installer. Since there is no system Python on Windows, you don't need to setup a virtual environment to avoid messing up with your system: Python is isolated in the installation directory you chose. And don't install Python into "Program Files" unless you know what you are doing, as recent Windows versions are a bit crazy about permissions in this directory, so the subsequent 'pip install' command(s) would probably fail unless you ran them as Administrator, which is definitely not required if you keep the default installation directory.

Happy flying!

To finish, the two screenshots from the home page: Image and
Image
rominet
 
Posts: 468
Joined: Sat Nov 01, 2014 1:33 pm
Callsign: F-KATS
Version: Git next
OS: Debian GNU/Linux

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Thu Sep 03, 2015 9:50 pm

Hello,

I have uploaded FFGo 1.1.0. The main news is that it is now available as a Debian package, along with its dependency CondConfigParser. So, for Debian users, the only thing needed to install FFGo is to add the appropriate line to /etc/apt/sources.list according to the instructions given on the FFGo home page, and run 'apt-get update && apt-get install ffgo', or an equivalent command with their package manager of choice.

Apart from that, the new release is mostly some layer of polish over version 1.0.0.
  • There is a new option, enabled by default, to remember the position of the main window---not only the size, as in FGo! 1.5.5 and FFGo 1.0.0. This will allow users to precisely save the layout of all three main windows (Main Window, Command Window and Output Window) and have it automatically restored on restart or when loading a particular configuration file where this layout was saved.
  • The main window geometry, as for the other two, is now restored from the config when pressing the “Reload config” button.
  • The FlightGear arguments and output are now shown in the default configuration, hopefully improving the first-time experience.
  • Some recently-added configuration parameters were not documented in the 'presets' file, this is now corrected (SHOW_FG_COMMAND, SHOW_FG_COMMAND_IN_SEPARATE_WINDOW, FG_COMMAND_GEOMETRY, SHOW_FG_OUTPUT, SHOW_FG_OUTPUT_IN_SEPARATE_WINDOW and FG_OUTPUT_GEOMETRY).
  • ... stuff like that.

For details about the changes, see the ChangeLog file or, more detailed and developer-centric, the Git repository log.

I now know the pip-based installation procedure works fine under Windows, and that FFGo runs there too. My tester didn't go as far as running FlightGear (not installed on her computer...), but I am relatively confident now that I know the main window is properly displayed. Please report anyway.

The non-English translations are still very much outdated, so feel free to read docs/INFORMATION_FOR_TRANSLATORS and contribute a little update in this area, otherwise choosing a non-English language is always going to produce a mix-match of English and non-English words... Thanks in advance.
rominet
 
Posts: 468
Joined: Sat Nov 01, 2014 1:33 pm
Callsign: F-KATS
Version: Git next
OS: Debian GNU/Linux

Re: Announcing FFGo: a new FlightGear launcher

Postby pommesschranke » Sat Sep 05, 2015 7:46 am

i did use it, "save and quit"
and on the next start I get:

Code: Select all
Traceback (most recent call last):
  File "/usr/games/ffgo", line 9, in <module>
    load_entry_point('FFGo==1.1.0', 'console_scripts', 'ffgo')()
  File "/usr/lib/python3/dist-packages/ffgo/main.py", line 85, in main
    sys.exit(run(master))
  File "/usr/lib/python3/dist-packages/ffgo/main.py", line 57, in run
    config = Config(master)
  File "/usr/lib/python3/dist-packages/ffgo/config.py", line 111, in __init__
    self.update(first_run=True)
  File "/usr/lib/python3/dist-packages/ffgo/config.py", line 292, in update
    self.scenario_list, self.carrier_list = self._readScenarios()
  File "/usr/lib/python3/dist-packages/ffgo/config.py", line 683, in _readScenarios
    scenario_name)
  File "/usr/lib/python3/dist-packages/ffgo/config.py", line 695, in _append_carrier_data
    root = self._get_root(xml)
  File "/usr/lib/python3/dist-packages/ffgo/config.py", line 709, in _get_root
    tree.parse(xml)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 598, in parse
    self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 32, column 50


with another saved FFGo config:
Code: Select all
    for i in self.config.scenario_list:
AttributeError: 'Config' object has no attribute 'scenario_list'
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.4/tkinter/__init__.py", line 1490, in __call__
    return self.func(*args)
  File "/usr/lib/python3/dist-packages/ffgo/gui/mainwindow.py", line 526, in configLoad
    self.reset(path=p)



Code: Select all
File "/usr/lib/python3/dist-packages/ffgo/config.py", line 231, in update
    del self.airport_icao
AttributeError: airport_icao

pommesschranke
 
Posts: 1092
Joined: Sat Apr 27, 2013 7:58 pm
Location: EDLM & LJCE
Callsign: d-laser
IRC name: laserman
Version: git
OS: Linux Lubuntu 14.04

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Sat Sep 05, 2015 1:52 pm

Hello pommesschranke, thanks for your feedback!

I would have preferred to read “It works beautifully”, but let's see what we can do. :wink:

First, the paths you copy/pasted indicate a system installation (/usr/games/ffgo, /usr/lib/python3/dist-packages/ffgo, etc.), but your profile says you are using Linux Mint. Did you install from the Debian package by chance? And if so, is it on jessie, unstable?.. Can you give the Python version running FFGo (I could add that to the About box, that would be useful for bug reports)? And also, did you start with a previously-working FGo! config file, or with the default FFGo config?

OK, I prefer dealing with one error at a time, because the second and third errors may well be consequences of the first one.

The traceback you posted seems to indicate an invalid XML file among the FG scenarios. These are located under $FG_ROOT/AI and should end in '.xml'. It would be useful to examine the particular file causing the error. To know this, you can insert the following line in ffgo/config.py (in your case, /usr/lib/python3/dist-packages/ffgo/config.py), right above the line 695 ('root = self._get_root(xml)', normally):
Code: Select all
                print("About to parse {!r}".format(path))

(indentation is important)

This is not a fix, but it can be useful to understand what is really happening, especially at line 32, column 50 of this file according to your error message.

Then, I can see the ElementTree API is apparently not respected in the _get_root() method a few lines below. It never failed on my system, nor on that of FGo!'s author presumably (since he wrote these lines), but it doesn't seem to be conformant. Maybe different versions of ElementTree have different behaviors. Anyway, the same problem is also present in ffgo/gui/mainwindow.py, so here is a first patch using ElementTree in a way conformant to https://docs.python.org/3/library/xml.etree.elementtree.html#module-xml.etree.ElementTree (and which should be more robust in case an XML file has a non-ASCII encoding). Can you apply it (after removing the debugging 'print' line we put above)? Otherwise, if I push it to the Git repo, will you be able to test it? I can say it works here, but I'd prefer knowing if it fixes the problems you encountered.
Code: Select all
diff --git a/ffgo/config.py b/ffgo/config.py
index d795628..0aa0769 100644
--- a/ffgo/config.py
+++ b/ffgo/config.py
@@ -7,7 +7,7 @@ import gzip
 import contextlib
 import gettext
 import traceback
-from xml.etree.ElementTree import ElementTree
+from xml.etree import ElementTree
 from tkinter import IntVar, StringVar
 from tkinter.messagebox import askyesno, showinfo, showerror
 import tkinter.font
@@ -676,7 +676,7 @@ configurations are kept separate.""")
                 path = os.path.join(self.ai_path, f)
 
                 if os.path.isfile(path):
-                    if f.lower().endswith('xml'):
+                    if f.lower().endswith('.xml'):
                         scenario_name = f[:-4]
                         scenarios.append(scenario_name)
                         carriers = self._append_carrier_data(carriers, path,
@@ -689,24 +689,23 @@ configurations are kept separate.""")
             return [], []
 
     def _append_carrier_data(self, list_, path, scenario_name):
-        with open(path) as xml:
-            try:
-                list_copy = list_[:]
-                root = self._get_root(xml)
-                scenario = root.find('scenario')
-                entries = scenario.findall('entry')
-                for e in entries:
-                    name = e.find('type')
-                    if name.text == 'carrier':
-                        data = self._get_carrier_data(e, scenario_name)
-                        list_copy.append(data)
-                return list_copy
-            except (AttributeError, OSError):
-                return list_
-
-    def _get_root(self, xml):
-        tree = ElementTree()
-        tree.parse(xml)
+        try:
+            list_copy = list_[:]
+            print("About to parse {!r}".format(path))
+            root = self._get_root(path)
+            scenario = root.find('scenario')
+            entries = scenario.findall('entry')
+            for e in entries:
+                name = e.find('type')
+                if name.text == 'carrier':
+                    data = self._get_carrier_data(e, scenario_name)
+                    list_copy.append(data)
+            return list_copy
+        except (AttributeError, OSError):
+            return list_
+
+    def _get_root(self, xmlFilePath):
+        tree = ElementTree.parse(xmlFilePath)
         return tree.getroot()
 
     def _get_carrier_data(self, e, scenario_name):
diff --git a/ffgo/gui/mainwindow.py b/ffgo/gui/mainwindow.py
index 521a6ba..f89b58d 100644
--- a/ffgo/gui/mainwindow.py
+++ b/ffgo/gui/mainwindow.py
@@ -16,7 +16,7 @@ import queue as queue_mod       # keep 'queue' available for variable bindings
 from tkinter import *
 import tkinter.filedialog as fd
 from tkinter.scrolledtext import ScrolledText
-from xml.etree.ElementTree import ElementTree
+from xml.etree import ElementTree
 from tkinter.messagebox import showerror
 import condconfigparser
 
@@ -772,19 +772,18 @@ class App:
 
         return res
 
-    def read_parking(self, xml_file):
+    def read_parking(self, xmlFilePath):
         """Read parking positions from XML file."""
         res = []
-        with open(xml_file) as xml:
-            root = self._get_root(xml)
-            parking_list = root.find('parkingList')
-            if parking_list is None:
-                parking_list = root.find('parkinglist')
-            parkings = parking_list.findall('Parking')
-            for p in parkings:
-                name = p.get('name').split('"')[0]
-                number = p.get('number').split('"')[0]
-                res.append(''.join((name, number)))
+        root = self._get_root(xmlFilePath)
+        parking_list = root.find('parkingList')
+        if parking_list is None:
+            parking_list = root.find('parkinglist')
+        parkings = parking_list.findall('Parking')
+        for p in parkings:
+            name = p.get('name').split('"')[0]
+            number = p.get('number').split('"')[0]
+            res.append(''.join((name, number)))
         res = list(set(res))  # Remove doubles
         res.sort()
         return res
@@ -794,20 +793,19 @@ class App:
         text = ''
         file_name = scenario + '.xml'
         path = os.path.join(self.config.ai_path, file_name)
-        with open(path) as xml:
-            root = self._get_root(xml)
-            # There is no consistency along scenario files where
-            # the <description> tag can be found in the root tree,
-            # therefore we are making a list of all occurrences
-            # of the tag and return the first element (if any).
-            descriptions = root.findall('.//description')
-            if descriptions:
-                text = self._rstrip_text_block(descriptions[0].text)
+        root = self._get_root(path)
+        # There is no consistency along scenario files where
+        # the <description> tag can be found in the root tree,
+        # therefore we are making a list of all occurrences
+        # of the tag and return the first element (if any).
+        descriptions = root.findall('.//description')
+        if descriptions:
+            text = self._rstrip_text_block(descriptions[0].text)
+
         return text
 
-    def _get_root(self, xml):
-        tree = ElementTree()
-        tree.parse(xml)
+    def _get_root(self, xmlFilePath):
+        tree = ElementTree.parse(xmlFilePath)
         return tree.getroot()
 
     def _rstrip_text_block(self, text):


Many thanks for your feedback!
rominet
 
Posts: 468
Joined: Sat Nov 01, 2014 1:33 pm
Callsign: F-KATS
Version: Git next
OS: Debian GNU/Linux

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Sat Sep 05, 2015 2:28 pm

If you don't want to apply the patch as root under /usr/lib/python3/dist-packages/ (which I can well understand), I'd suggest the following:
  • either clone the Git repo and apply the patch from there (for instance, you can save the patch as /tmp/elementreeTree-fix.patch and run:
    Code: Select all
    git apply /tmp/elementreeTree-fix.patch
    from the root repo directory);
  • or unpack a release tarball and apply the patch from there with
    Code: Select all
    patch -p1 </tmp/elementreeTree-fix.patch

In the first case, in order to have a working FFGo setup, you need to install a few things (cf. docs/INSTALL/INSTALL_en, section “Installation from the Git repository”) and run 'make' from the top-level repo directory.

After that, you can run FFGo with the ffgo-launcher.py script in the top-level dir without installing anything (you should already have the dependencies installed because of the packages you presumably installed from your previous message). Maybe you will have to specify the interpreter, as in:
Code: Select all
python3.4 ffgo-launcher.py

or:
Code: Select all
/path/to/python3.4 ffgo-launcher.py


if the 'python3' executable from your PATH doesn't have FFGo's dependencies installed for it.
rominet
 
Posts: 468
Joined: Sat Nov 01, 2014 1:33 pm
Callsign: F-KATS
Version: Git next
OS: Debian GNU/Linux

Re: Announcing FFGo: a new FlightGear launcher

Postby pommesschranke » Sun Sep 06, 2015 7:52 am

The file that made FFGo crash was a HTML File,
One of those download links that are not download links but links
to file-hosting-service with a download button.

the file starts like this:

Code: Select all
<!DOCTYPE html><html lang="de" xmlns:fb="http://ogp.me/ns/fb#" xml:lang="de" xmlns="http://www.w3.org/1999/xhtml" class="media-desktop"><head><script nonce="8480141480794904701">


thank you for your help!
pommesschranke
 
Posts: 1092
Joined: Sat Apr 27, 2013 7:58 pm
Location: EDLM & LJCE
Callsign: d-laser
IRC name: laserman
Version: git
OS: Linux Lubuntu 14.04

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Sun Sep 06, 2015 9:23 am

Ah, good news. So, everything works fine, now?

I am going to try to improve the parsing of these XML files anyway. First, as already in the patch I sent you yesterday, it considers all files ending in 'xml' instead of '.xml', so that might use files such as 'foobar.blablaxml', not great. Second, it tends to silence OSError and AttributeError while scanning these files, and I don't like that. If there is an error (permission or XML parsing error, typically), I prefer seeing it so it can be fixed instead of having missing choices in the interface and not being able to say why. And third, I think it could be more rigorous in the way it matches elements. For instance:

Code: Select all
<foobar>
  <baz>
    <name>pouet</name>
    bla
  </baz>
  <name>name of foobar</name>
</foobar>


There are difference between iterating over direct children of <foobar> named 'name' and all descendants named 'name'. It seems to me the current code (probably not used in FGo! 1.5.5, because Robert said he replaced manual XML parsing with use of the ElementTree library as he did the port to Python 3) is not very rigorous in this area. I am going to fix this too, but I have to make a few tests before because the ElementTree documentation seems to be inconsistent or at least pretty much unclear regarding this thing of direct vs. indirect descendants. Also, it can be that the syntax in FG XML files is not very well defined and that some files use some syntax and other files a slightly different syntax (I seem to recall seeing a comment from Robert in this sense in the code). So, we'll have to test a bit before claiming the thing stable.

There was code silencing errors in this part (parsing XML scenario files) but there should be no such thing in all the command-line building, fgfs process calling and monitoring, and output logging because I have written/inspected this part very carefully. It should also be a bit more efficient than in FGo! because I used mechanisms to avoid having to check every 100 ms if the fgfs process has exited (I hate this kind of thing).

Also, for those who use the Git repo, the French translation of the interface is now complete. I have not yet translated the help file, though.

Have fun.
rominet
 
Posts: 468
Joined: Sat Nov 01, 2014 1:33 pm
Callsign: F-KATS
Version: Git next
OS: Debian GNU/Linux

Re: Announcing FFGo: a new FlightGear launcher

Postby pommesschranke » Sun Sep 06, 2015 4:41 pm

rominet wrote in Sun Sep 06, 2015 9:23 am:Ah, good news. So, everything works fine, now?


The only problem I noticed today:
For many airports it does not show parking locations, but flightgear has them.
FGo! had the same issue - I fixed it locally by hardcoding the Airports path in mainwindow.py:
Code: Select all
  else:
            # If airport data source is set to: From scenery...
            if True:
                paths = ['/mh/fg-fgmeta/install/flightgear/fgdata/Airports']
                #L = self.config.FG_scenery.get().split(':')
                #print L
                #for path in L:
                #    paths.append(os.path.join(path, DEFAULT_AIRPORTS_DIR))


FFGo reads parking locations from apt.dat
or groundnet.xml or both ?

AFAIK flightgear still does not read them from apt.dat
so it would be nice when FFGo converts it into --lon , --lat
and heading instead of --parkpos with a name that FG does not know.

btw:
Code: Select all
fgfs --parkpos=EGKK London Gatwick Ramp #3111 --aircraft=ufo
config file not found:London
config file not found:Gatwick
config file not found:Ramp
pommesschranke
 
Posts: 1092
Joined: Sat Apr 27, 2013 7:58 pm
Location: EDLM & LJCE
Callsign: d-laser
IRC name: laserman
Version: git
OS: Linux Lubuntu 14.04

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Mon Sep 07, 2015 6:37 pm

pommesschranke wrote in Sun Sep 06, 2015 4:41 pm:The only problem I noticed today:
For many airports it does not show parking locations, but flightgear has them.
FGo! had the same issue


Not very surprising, this code has not seen any change since FGo! 1.5.5. But if you're hoping to get something improved, don't say "For many airports...", please give precise examples that I can test. Using EGKK for instance, I have all these parking positions available:
Image

and if I chose parkpos 1 from this popup, FFGo passes --parkpos=1 to fgfs and I arrive here:
Image

Personally, since I use TerraSync, I have been using "Airport data source" = Scenery for months (and according to Robert's recommendation in the option tooltip, I always pass --prop:/sim/paths/use-custom-scenery-data=true to fgfs). This is not the default in FGo!, and I have not changed it in FFGo for fear of not getting the big picture well enough to be sure not to break things for users.

Please give the configuration you use:
  • the "Airport data source" parameter in the Preferences dialog, Miscellaneous tab---corresponding to the APT_DATA_SOURCE parameter in the config file (~/.ffgo/config everywhere except on Windows, where it is %APPDATA%/FFGo/config);
  • which airport is selected in the FFGo interface;
  • which parkpos doesn't show up;
  • and where the corresponding parking data is supposed to come from (TerraSync, a custom scenery folder? Which one, where can I download the thing to test?...).

pommesschranke wrote in Sun Sep 06, 2015 4:41 pm: - I fixed it locally by hardcoding the Airports path in mainwindow.py:

Umm:

  • Why did you replace
    Code: Select all
    if self.config.apt_data_source.get():

    with
    Code: Select all
    if True:

    ?
    Just set the "Airport data source" parameter I mentioned above to "Scenery", there is no need to modify the code like this...
  • "print L" is Python 2 syntax, in Python 3 you have to write "print(L)" if you want it to work, because print() is now a function instead of a statement;
  • What is there in your '/mh/fg-fgmeta/install/flightgear/fgdata/Airports' directory that ffgo/gui/mainwindow.py:App.read_airport_data() can use?
    In my FG_ROOT/Airports (from FGData 3.7), there are only 2 files: apt.dat.gz and metar.dat.gz, and surely App.read_airport_data() can't read any of these as it stands. Or does the code you modify live elsewhere (file + line, please)?.. I highly doubt it, though.

    Looking at https://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/, I can't see anything like fgdata/Airports or Airports either, so... what do you have in that '/mh/fg-fgmeta/install/flightgear/fgdata/Airports' directory that brings you more parking positions?

pommesschranke wrote in Sun Sep 06, 2015 4:41 pm:FFGo reads parking locations from apt.dat
or groundnet.xml or both ?

For an airport whose code is ICAO:
  • If the "Airport data source" parameter is set to Scenery, it takes each component p of FG_SCENERY from left to right (where they are separated by ':'), and for each of them, reads parking data from the first file where it can find parking positions in directory 'p/Airports/I/C/A' whose name is either 'ICAO.parking.xml' or 'ICAO.groundnet.xml' (using directory listing order as given by os.listdir()). IOW, it will inspect both of these files in directory listing order in each 'p/Airports/I/C/A' directory and use the first one in which it finds at least one parking position.
  • If the "Airport data source" parameter is set to Default, it tries to read parking positions from 'FG_ROOT/AI/Airports/ICAO/parking.xml'.

So, no, apt.dat is not read for this. It's all in the function you modified. I don't know what FG does when the various sources overlap, therefore I have not touched to this algorithm so far.

pommesschranke wrote in Sun Sep 06, 2015 4:41 pm:AFAIK flightgear still does not read them from apt.dat
so it would be nice when FFGo converts it into --lon , --lat
and heading instead of --parkpos with a name that FG does not know.

That's an interesting idea, I'll think about it, thank you. I didn't know apt.dat had such information.

pommesschranke wrote in Sun Sep 06, 2015 4:41 pm:btw:
Code: Select all
fgfs --parkpos=EGKK London Gatwick Ramp #3111 --aircraft=ufo
config file not found:London
config file not found:Gatwick
config file not found:Ramp

Well, FG doesn't seem to know that, but apparently you ran this in a terminal and forgot to enclose the argument-containing-spaces inside double or single quotes?

In my fgdata/Airport/apt.dat.gz, there is no such thing as 'EGKK London Gatwick Ramp #3111', but there is 'EGKK London Gatwick Ramp #1' (and also #5 but that's all). Because of the '#' char, in order to use that in FFGo, you just have to put:
Code: Select all
--parkpos=EGKK London Gatwick Ramp \#1

in the Options Window (the one for fgfs command line options, to the left of the Output Window). Note the backslash to escape the '#' comment char (this is all explained at http://people.via.ecp.fr/~flo/projects/FFGo/doc/README-conditional-config/). You can always check the result in the Command Window. Then, FG 3.7 will say:
Code: Select all
Failed to find a parking at airport EGKK:EGKK London Gatwick Ramp #1

and put you on a runway.
rominet
 
Posts: 468
Joined: Sat Nov 01, 2014 1:33 pm
Callsign: F-KATS
Version: Git next
OS: Debian GNU/Linux

Re: Announcing FFGo: a new FlightGear launcher

Postby pommesschranke » Tue Sep 08, 2015 2:54 pm

thank you for explaining the details.
I guess I did try Airport Data Source : Scenery
but the scenery folder was not set in preferences but instead in the editor- window as a parameter:
Code: Select all
--fg-scenery=/mh/scenery/fgo


Now I did what you suggested and get this error:
Code: Select all
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.4/tkinter/__init__.py", line 1490, in __call__
    return self.func(*args)
  File "/usr/lib/python3/dist-packages/ffgo/gui/mainwindow.py", line 636, in popupPark
    for i in self.read_airport_data(self.config.airport.get(), 'park'):
  File "/usr/lib/python3/dist-packages/ffgo/gui/mainwindow.py", line 761, in read_airport_data
    res = self.read_parking(file_path)
  File "/usr/lib/python3/dist-packages/ffgo/gui/mainwindow.py", line 786, in read_parking
    number = p.get('number').split('"')[0]
AttributeError: 'NoneType' object has no attribute 'split'



when I click on the Parking button.
in apt.dat every position has a name , but no number.
here you find all the groundnet.xml files that I generated from apt.dat:
http://media.lug-marl.de/flightgear/Airports.tgz


EDDG.groundnet.xml
Code: Select all
<?xml version="1.0"?>
<groundnet>
    <parkingList>
        <Parking index="0" type="gate" name="Apron_East_20" lat="N52 7.942547" lon="E7 41.417315" heading="160.560000" />
        <Parking index="1" type="gate" name="Apron_East_24" lat="N52 7.997596" lon="E7 41.653370" heading="161.030000" />
        <Parking index="2" type="gate" name="Central_Apron_18" lat="N52 7.897825" lon="E7 41.239708" heading="253.330000" />
        <Parking index="3" type="gate" name="GAT_1" lat="N52 7.872005" lon="E7 40.941731" heading="90.530000" />
        <Parking index="4" type="gate" name="GAT_2" lat="N52 7.875767" lon="E7 40.994432" heading="87.240000" />
        <Parking index="5" type="gate" name="Gate_12" lat="N52 7.901150" lon="E7 41.625456" heading="199.740000" />
        <Parking index="6" type="gate" name="Gate_13" lat="N52 7.910852" lon="E7 41.675753" heading="197.920000" />
    </parkingList>
</groundnet>

pommesschranke
 
Posts: 1092
Joined: Sat Apr 27, 2013 7:58 pm
Location: EDLM & LJCE
Callsign: d-laser
IRC name: laserman
Version: git
OS: Linux Lubuntu 14.04

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Wed Sep 09, 2015 9:50 am

Hello,

pommesschranke wrote in Tue Sep 08, 2015 2:54 pm:I guess I did try Airport Data Source : Scenery
but the scenery folder was not set in preferences but instead in the editor- window as a parameter:
Code: Select all
--fg-scenery=/mh/scenery/fgo


Indeed, this is not equivalent. The basic parameters like this one are best set in the appropriate GUI dialogs when these exist.

pommesschranke wrote in Tue Sep 08, 2015 2:54 pm:Now I did what you suggested and get this error:

[...]

in apt.dat every position has a name , but no number.
here you find all the groundnet.xml files that I generated from apt.dat:
http://media.lug-marl.de/flightgear/Airports.tgz

Good, I could test with this file. The Git version of FFGo now accepts these parkings with no 'number' attribute. BTW, is there a document apart from FG's source code stating precisely what is legal in parking files?

There are a few other improvements:
  • Errors like the one you encountered cause an error window to appear, not only a traceback on the terminal.
  • FFGo has logging support showing the date, OS, FFGo and Python versions, and all other usual messages (including exceptions). The log file is ~/.ffgo/Logs/FFGo.log (%APPDATA%/FFGo/Logs/FFGo.log on Windows). I may add a little log rotation later.
  • The terminal is less verbose than the log file by default but you can pass --log-level=info or --log-level=verbose to the FFGo executable (not in the GUI!) to make it as verbose as you want.
  • With --log-level=info, you will now see messages such as:
    Code: Select all
    Reading parking positions from '/home/flo/flightgear/tmp/parking/Airports/L/F/P/LFPO.groundnet.xml'

    otherwise they are always written to the log file even if you didn't use the option.
  • You can launch FFGo with --help to see the available command line options.
rominet
 
Posts: 468
Joined: Sat Nov 01, 2014 1:33 pm
Callsign: F-KATS
Version: Git next
OS: Debian GNU/Linux

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Thu Sep 10, 2015 8:12 am

If you apply the following patch (works on top of Git commit 407b71ff64f5374e81e6f375f0e18c2a9f8af7c8), you can obtain the list of all parking positions in all airports know to FFGo in the log by pressing Ctrl-T or choosing 'Tools -> Test' in the menus.
Code: Select all
diff --git a/ffgo/gui/mainwindow.py b/ffgo/gui/mainwindow.py
index 26e99a1..6de1d75 100644
--- a/ffgo/gui/mainwindow.py
+++ b/ffgo/gui/mainwindow.py
@@ -148,6 +148,8 @@ class App:
         self.toolsmenu = Menu(self.menubar, tearoff=0)
         self.toolsmenu.add_command(label='METAR',
                                    command=self.showMETARWindow)
+        self.toolsmenu.add_command(label=_('Test'),
+                                   accelerator=_('Ctrl-T'), command=self.test)
         self.menubar.add_cascade(label=_('Tools'), menu=self.toolsmenu)
 
         self.helpmenu = Menu(self.menubar, tearoff=0)
@@ -368,6 +370,14 @@ class App:
         self.setupKeyboardShortcuts()
         self.startLoops()
 
+    def test(self, event=None):
+        for airport in self.config.airport_icao:
+            logger.debug("Looking at airport {}, found parkings:".format(
+                airport))
+            parkings = self.read_airport_data(airport, "park")
+            if parkings:
+                logger.debug(*parkings, sep='\n')
+
     def onControlF_KeyPress(self, event):
         self.runFG(event)
         return "break"
@@ -377,6 +387,7 @@ class App:
         return "break"
 
     def setupKeyboardShortcuts(self):
+        self.master.bind('<Control-KeyPress-t>', self.test)
         self.master.bind('<Control-KeyPress-f>', self.onControlF_KeyPress)
         self.master.bind('<Control-KeyPress-r>', self.onControlR_KeyPress)
         self.master.bind_all('<Control-KeyPress-q>', self.saveAndQuit)
@@ -778,6 +789,9 @@ class App:
         """Read parking positions from XML file."""
         logger.info("Reading parking positions from '{}'".format(xml_file))
         res = []
+        # if not os.path.getsize(xml_file):
+        #     return []
+
         with open(xml_file) as xml:
             root = self._get_root(xml)
             parking_list = root.find('parkingList')

(select manually, the SELECT ALL button inthe forum does not work!)

This goes to the log file only by default, but you can do:
Code: Select all
./ffgo-launcher.py --log-level=debug >~/.ffgo/Logs/whatever-you-want.log

to easily generate different logs from different configs (use 'ffgo' instead of './ffgo-launcher.py' if FFGo is installed normally, as usual).

This shows that the Airports.tgz you linked to has error(s), the first one being that Airports/B/I/K/BIKA.groundnet.xml is empty and thus not a valid XML file. If one ignores these empty files (uncomment the two lines I commented out in the patch), there is then Airports/K/A/B/KABR.groundnet.xml that has an unescaped
Code: Select all
&
sign in the 'name' attribute value at line 6:
Code: Select all
        <Parking index="2" type="gate" name="Hold_Short_Rwy_13_&_17" lat="N45 27.33727" lon="W98 25.54402" heading="252.5" />

Same problem at Airports/K/C/B/KCBF.groundnet.xml. AFAIK, these should be replaced with
Code: Select all
&amp;
rominet
 
Posts: 468
Joined: Sat Nov 01, 2014 1:33 pm
Callsign: F-KATS
Version: Git next
OS: Debian GNU/Linux

Re: Announcing FFGo: a new FlightGear launcher

Postby pommesschranke » Thu Sep 10, 2015 8:28 am

That sounds like some nice improvements.
Thank you!


is there a document apart from FG's source code stating precisely what is legal in parking files?


I don't think so.
sometimes you find readme files in the source tree or wiki articles, but they can be incomplete or outdated.
pommesschranke
 
Posts: 1092
Joined: Sat Apr 27, 2013 7:58 pm
Location: EDLM & LJCE
Callsign: d-laser
IRC name: laserman
Version: git
OS: Linux Lubuntu 14.04

Next

Return to Development

Who is online

Users browsing this forum: No registered users and 2 guests