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.

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Tue May 24, 2016 9:12 am

I edited my previous message please reread it. Your bad install probably comes from 'sudo pip install ffgo' (don't do that at home, kids!!) you posted yesterday, or something very close.
rominet
 
Posts: 550
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 daweed » Tue May 24, 2016 9:15 pm

All is working now, i never pass to install via git, but pip install is ok

Parking pos work very well, i had some error, but it's in my xml file (route associated with gate is None and ffgo doesn't like :) )

So nice feature, log position, configuration box, i added my personal config parameter, easy way. My Fg hardware Interface work perfectly

Thanks, that "save" my life, i was boring to have to reset pos at beginning , nice way to read long / lat / heading and set parameter

So thanks a lot
Linux Mint 18.3
AMD FX 4300 Quad-Core Black Edition|20 Go RAMGeForce GTX 750 Ti
FG Interface
Lyon Saint Exupery Scenery
daweed
 
Posts: 264
Joined: Thu Dec 11, 2014 10:45 am
Location: LFKP LFLL
Callsign: daweed
OS: Windows 10 Familly

Re: Announcing FFGo: a new FlightGear launcher

Postby PINTO » Tue May 24, 2016 9:26 pm

rominet wrote in Tue May 24, 2016 9:12 am:Your bad install probably comes from 'sudo pip install ffgo' (don't do that at home, kids!!)


Image
Actively developing the MiG-21bis (link to repo) (link to thread)

http://opredflag.com is an active flightgear dogfighting community (using a system that isn’t bombable)
User avatar
PINTO
 
Posts: 923
Joined: Wed Oct 21, 2015 6:28 pm
Callsign: pinto
Version: 2016.3.0
OS: Win10

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Tue May 24, 2016 9:41 pm

Ah, I am glad to read that. :)

Concerning the warning with some parkings having 'None' for some-field-I-don't-remember: yes, I have seen it in a few places. I just hope it will push people to report and fix bugs in the affected groundnet files instead of having the syntax become looser and looser over time. That is why I let the warning.

When you have time, don't forget to explore the Tools menu and read the FFGo conditional config documentation (see this message to make aircraft-dependent joystick bindings as well as the first message about FFGo for concrete examples).

Happy flying. :wink:
rominet
 
Posts: 550
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 » Tue May 24, 2016 10:16 pm

@PINTO: maybe I should put your image in the wiki instructions :lol:

@all beginners: another nice trick is to click in front of "Airport:" on the ICAO code, right below the aircraft image. This allows easy selection of an AI carrier for single player operations. This is explained in Help -> Help, which shows the help file for the selected language.
rominet
 
Posts: 550
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 chris_blues » Tue May 24, 2016 11:34 pm

PINTO wrote in Tue May 24, 2016 9:26 pm:Image

I do that all the time! :mrgreen:
Don't hesitate to let me know if I'm incorrect or just annoying! As long as you do it gently! :)
Debian testing 64bit - Athlon II 2x2.6GHz - 8GB RAM - GeForce GTS 450
Citation II
User avatar
chris_blues
 
Posts: 1526
Joined: Mon May 03, 2010 1:30 pm
Location: claws of real life
Callsign: chris_blues
Version: GIT
OS: Debian 8 64

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Wed May 25, 2016 2:20 pm

Another application of FFGo's conditional config support is when you have a number of more or less complicated fgfs options that you only use in particular situations. Instead of keeping them in commented-out form in your FFGo config, it is more convenient to put them uncommented inside a conditional section and just change the value of a CondConfigParser variable when you want to activate or deactivate the conditional section. For instance, you could have the following in your Options Window (left of FFGo's main window, where you put your fgfs options):
Code: Select all
{ name_of_your_choice = "" }

# Put your "normal", all-situations, fgfs options here
--prop:string:/sim/terrasync/http-server=automatic # for new TerraSync (FG 2016.2.1 and later)
--download-dir=/some/path/of/your/choice
--enable-fullscreen

[ name_of_your_choice == "MP-carrier-LXGB" ]
--prop:/ai/models/carrier/position/latitude-deg=36.01811
--prop:/ai/models/carrier/position/longitude-deg=-5.32529
--prop:/ai/models/carrier/position/altitude-ft=0
--prop:/ai/models/carrier/orientation/true-heading-deg=230
#--prop:/ai/models/carrier/navaids/tacan/channel-ID=029Y
--prop:/ai/models/carrier/velocities/speed-kts=0

With this example, since the 'name_of_your_choice' variable is defined as the empty string ("") in the brace-delimited section at the top of the config, the boolean expression:
Code: Select all
name_of_your_choice == "MP-carrier-LXGB"

will be false and, as a consequence, the corresponding conditional section won't be activated. Thus, fgfs will be passed:
Code: Select all
--prop:string:/sim/terrasync/http-server=automatic
--download-dir=/some/path/of/your/choice
--enable-fullscreen

but not the --prop:... options of the conditional section.

You just have to change the first line to:
Code: Select all
{ name_of_your_choice = "MP-carrier-LXGB" }

to activate the conditional section, which will allow you to easily spawn a Nimitz multiplayer carrier near Gibraltar (LXGB) if you start FG with the 'nimitz' aircraft (one could even include '--aircraft=nimitz' in the conditional section). You can define other variables in the brace-delimited section, just put them on separate lines and don't forget to terminate that section with a closing brace: }.

(note that there is only one = character in this case, as it is a variable assignment and not a boolean operator)

You can have as many conditional sections as you want. For instance, the following ones will allow you to easily put an MP carrier on the Seine in Paris (!) or on the lake at EDNY, very close to Innsbruck (LOWI):
Code: Select all
[ name_of_your_choice == "MP-carrier-Seine" ]
--prop:/ai/models/carrier/position/latitude-deg=48.86338
--prop:/ai/models/carrier/position/longitude-deg=2.30667
--prop:/ai/models/carrier/position/altitude-ft=20
--prop:/ai/models/carrier/orientation/true-heading-deg=260
--prop:/ai/models/carrier/velocities/speed-kts=0

[ name_of_your_choice == "MP-carrier-EDNY" ]
--prop:/ai/models/carrier/position/latitude-deg=47.57024
--prop:/ai/models/carrier/position/longitude-deg=9.47860
# Unfortunately, I believe the glide slope assumes the carrier is at sea level
--prop:/ai/models/carrier/position/altitude-ft=1279.11
--prop:/ai/models/carrier/orientation/true-heading-deg=230
--prop:/ai/models/carrier/velocities/speed-kts=0

The boolean expressions inside brackets ([ and ]) can be much more complex, using parentheses, possibly list membership tests, etc. in a way similar to Python expressions (most notably, operator precedence should be the same). As in Python, when something is open with a { or a [, you can break lines as you want until the corresponding } or ]. For other cases, continuation lines can be started with a backslash (\) at the end of a line, just as in Python too. For more details on this, see FFGo's conditional config documentation.

I believe I got the --prop magic settings for MP carrier positioning from a post by PINTO, so thanks to him/her. :)
rominet
 
Posts: 550
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 PINTO » Wed May 25, 2016 3:34 pm

I am a him. =] and I did not realize this feature existed. This is awesome and will save me a bunch of time.

This is by and far the best launcher for FG. Thanks for all your hard work!
Actively developing the MiG-21bis (link to repo) (link to thread)

http://opredflag.com is an active flightgear dogfighting community (using a system that isn’t bombable)
User avatar
PINTO
 
Posts: 923
Joined: Wed Oct 21, 2015 6:28 pm
Callsign: pinto
Version: 2016.3.0
OS: Win10

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Thu May 26, 2016 2:21 pm

Ah, thank you. I was starting to fear I would be the only one ever using this feature (it has been in FFGo from day one)...

Another thing while we are at it: I said you may include --aircraft=<some aircraft> in a conditional section. This is true, but will result in two --aircraft options being passed to fgfs, because of the aircraft selected in the aircraft list. First, this is ugly and second, it may or may not work, depending on how FG handles this. But there is a remedy for this: the special CondConfigParser variable named MERGED_OPTIONS. For instance, in my config, I always have:
Code: Select all
  MERGED_OPTIONS = ["--airport=", "--aircraft=", "--parking-id=",
                    "--runway=", "--carrier=", "--parkpos=",
                    "--com1=", "--com2="]

in the brace-delimited section for variable declarations (at the top of the config, as explained in my previous message). This ensures that none of these options is duplicated when building the fgfs argument list. This way, I can safely include for instance --airport=XYZT in some particular conditional sections, and be sure it will replace the airport selected in the airport list. The precise rules are explained here in the FFGo conditional config documentation.

Also, looking at the beginning of this document, one thing is now easier than when it was written: the output of 'fgfs --help --verbose' (to know which fgfs options are available) can be obtained by simply choosing Show available fgfs options in the Help menu.
rominet
 
Posts: 550
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 20, 2016 10:45 am

When I hover the mouse over an airport ICAO or name, FFGo tells me lat/lon.
How did you do that ?
Where can I find it in the sourcecode?
I'd like to use it for one of my own projects.

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

Re: Announcing FFGo: a new FlightGear launcher

Postby chris_blues » Tue Sep 20, 2016 10:48 am

I believe FFGo reads the apt.dat file and extracts the coordinates from there. (Not entirely sure)
Don't hesitate to let me know if I'm incorrect or just annoying! As long as you do it gently! :)
Debian testing 64bit - Athlon II 2x2.6GHz - 8GB RAM - GeForce GTS 450
Citation II
User avatar
chris_blues
 
Posts: 1526
Joined: Mon May 03, 2010 1:30 pm
Location: claws of real life
Callsign: chris_blues
Version: GIT
OS: Debian 8 64

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Tue Sep 20, 2016 2:11 pm

That's correct. You can start in ffgo/gui/mainwindow.py:
Code: Select all
        def airportListTooltipFunc(region, itemID, column, self=self):
            if region == "cell":
                icao = self.airportList.set(itemID, "icao")
                found, airport = self.readAirportData(icao)

                return airport.tooltipText() if found else None

This relies on App.readAirportData() defined in the same file. This method first looks if we already have the information available in memory (because of the user having recently displayed the same tooltip for instance):
Code: Select all
    def readAirportData(self, icao):
        """Read airport data from self.config.aptDatCache or apt.dat.

        Return a tuple of the form (found, airport) where 'found' is a
        boolean and airport an Airport instance, or None when 'found' is
        False.

        """
        for cachedIcao, cachedAirport in self.config.aptDatCache:
            if cachedIcao == icao:
                found = True
                airport = cachedAirport
                break

If not, it fetches it from apt.dat(.gz), using an index stored in ~/.ffgo/apt for fast access. Once we have the index, the fetching is done with:
Code: Select all
            with AptDat(aptPath) as aptDat:
                found, airport = aptDat.readAirportDataUsingIndex(icao, index)

which brings you to ffgo/fgdata/apt_dat.py where you'll find all the apt.dat parsing code:
Code: Select all
    def readAirportDataUsingIndex(self, icao, index):
        """Read detailed airport data from apt.dat using an index.

        'index' should be a sequence (byteOffset, lineNb) where
        'byteOffset' points to the start of the first line defining the
        airport in apt.dat, and 'lineNb' is the corresponding line
        number (starting from 1).

        Return a tuple of the form (found, data) where:
          - 'found' is a boolean indicating whether airport data for
            the specified 'icao' was found at 'index';
          - 'data' is an Airport instance if the data was found,
            otherwise None.

        """
        [...]
        self.lineNb = index[1]

        code, payload = self._readRecord()

        # 1, 16, 17: land airport, seaplane base or heliport
        if code not in (1, 16, 17):
            return (False, None)

        try:
            foundIcao, type_, name, elev = self._processAirportHeader(code,
                                                                      payload)
        except UnableToParseAptDat:
            return (False, None)
        [...]

Latitude and longitude can also be fetched directly from ~/.ffgo/apt: it was necessary to cache them there[1], otherwise the Airport Finder would be dreadfully slow, since it has to iterate over all airports. The underlying problem is that apt.dat is a very poor database: large and without any index (and not even sorted by airport code, which is why FG has the numbers of lines of apt.dat, fix.dat, etc. all hardcoded in its C++ files, which explains why you get meaningless percentage progress info when FG rebuilds its navdata cache from an apt.dat or fix.dat, etc. that doesn't match the hardcoded values).

[1] Along with building the index, this is what takes time when FFGo "rebuilds the airport database".
rominet
 
Posts: 550
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 20, 2016 3:11 pm

interesting information. thank you! but still..

Airport viewpoint = tower view location
and
Windsock are both optional and
I cannot find the location of airport reference point in apt.dat

so, which lat/lon do you show ?
The first elemet that you find in the airport block ?
first edge of first runway ?
what if it is a heliport and has no runway?

..I found the answer:
Code: Select all
# Will give the coordinates of the centroid of all runway ends +
# helipads of the airport (each runway has a sort of “double weight”
# because of its two ends, contrary to a helipad).
avgLat, avgLon = None, None
nvecSum = NVector(0.0, 0.0, 0.0)


Code: Select all
                avgLat, avgLon = map(misc.DecimalCoord,
                nvecSum.scalarDiv(n).latLon())


https://pypi.python.org/pypi/nvector

fancy stuff! ;-)

btw:
* FG has 6741 ICAO.twr.xml files
* apt.dat has 8163 tower viewpoints

.. but we have 28057 land airports.
(+583 seaplane bases + 6081 heliports)
pommesschranke
 
Posts: 1100
Joined: Sat Apr 27, 2013 7:58 pm
Location: EDLM & LJCE
Callsign: d-laser
IRC name: laserman
Version: git
OS: Linux Lubuntu 18.04

Re: Announcing FFGo: a new FlightGear launcher

Postby rominet » Tue Sep 20, 2016 4:55 pm

That's right, there is no such thing as "the airport latitude/longitude" in apt.dat; this detail had slipped out of my mind. As you found out, FFGo computes an airport centroid based on the coordinates of runway ends and helipad centers, all of which are in apt.dat.

As for the figures you gave, the explanation you probably already know is that, IIRC the airport viewpoint in apt.dat (row code 14) is optional.

And concerning nvectors, they are nice because they don't have singularities at the ±180° meridian nor at the poles.
rominet
 
Posts: 550
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 » Tue Sep 20, 2016 5:03 pm

By the way, there is a similar thing for runway headings in apt.dat v850 and later format: we have to compute them from the latitude and longitude of the two runway ends. Same thing for runway length: it has to be computed too (however, the width is explicitely given).
rominet
 
Posts: 550
Joined: Sat Nov 01, 2014 1:33 pm
Callsign: F-KATS
Version: Git next
OS: Debian GNU/Linux

PreviousNext

Return to Development

Who is online

Users browsing this forum: No registered users and 4 guests