Board index FlightGear Development Nasal

Spoken ATC

Nasal is the scripting language of FlightGear.

Re: Spoken ATC

Postby clm76 » Tue Aug 08, 2017 11:37 am

Hi Rodolpho,

I brought some modifications to atc_tools.nas and voice.nas to prevent some errors.
Voice.nas :
Replaced stationg== "tower" by station== "tower"
Code: Select all
   } else if(relpos=="onground"){
       if(station=="tower" and prev=="land clearance"){
           msg = TWRvoice();
      } else if(station=="ground" or (stationg=="tower" and freqs["GND"]==nil)) {
               msg = GNDvoice();
      }


When loading a plane, it can be the default runway which is loaded by Fg but the ATC code can choose another runway as « best » runway depending of the wind direction. It’s the case, for example, at LFPG which have two runways nearly parrallel (08L and 09L). If the plane is on the runway 08L, the ATC choose 09L as runway when the wind is 150 deg and 3 knots.
So, I modify the code, using the property sim/atc/runway
Code: Select all
foreach(var rw; keys(rws)){
    if (dest_rwy != nil and dest_rwy == rw) {
      best = rw;
      break;
    } else {
       if (rw == getprop("sim/atc/runway")) {
   best = rw;
   break;
        }else {
   var a = abs(info.runways[rw].heading - getprop("/environment/metar/base-wind-dir-deg"));
   if(a<ang) {
     ang = a;
     best = rw;
           }
        }
     }
}


To correct the problem which occurs at LFPG (and possibly in others airport) which is near of LFPB and where it’s LFPG Tower which manages LFPB, I introduced a library of exceptions like this :
Code: Select all
# *** ICAO exceptions ****************************************
  var ICAOexc = func(arg) {   
      var station_name = getprop("/instrumentation/comm/station-name");
      if (arg == "LFPB" and left(station_name,9) == "DE GAULLE") icao = "LFPG";
      return icao;
   }

# *** Main ****************************************

   # 1) Get properties
   var cs = getprop("/sim/multiplay/callsign");
   cs = string.replace(cs,"-","");
   var icao = getprop("/instrumentation/comm/airport-id");   
   ICAOexc(icao);
   var info = airportinfo(icao);
            ……

There is only LFPG and LFPB in this library but perhaps some others airports in the world have the same managment, So, it’s simple to complete the library.
It’s also possible to create this library outside voice.nas in another file named library.nas or exception.nas

atc_tools.nas

Some airports like LSGG (Geneva) doesn’t have « TWR » or « APP »returned by
Code: Select all
var f = getfreqs(arg.apt);

in phraseology.nas, but « Geneva Tower... » or «Geneva approach » and that gives a nasal error  « no such member : TWR »
I modified the code in atc_tools.nas, line 54, like this :
Code: Select all
 
            if(hash["TWR"]==nil and (string.match(hash.ident,"*TWR") or string.match(hash.ident,"*ower"))) typ ="TWR";
            if(hash["APP"]==nil and (string.match(hash.ident,"A/G") or string.match(hash.ident,"*pproach"))) typ ="APP";
            freqs[typ] = sprintf("%.2f", hash.frequency);}
    }
      return freqs; 


It’s all for the moment !... :)
If you prefer, you can download the modified files here :
http://www.mediafire.com/file/s7kftt62l ... _tools.nas
http://www.mediafire.com/file/cl1lxv9lfo5fwlo/voice.nas
clm76
 
Posts: 204
Joined: Tue Oct 30, 2012 9:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2020.4.0
OS: Linux Mint 20.2

Re: Spoken ATC

Postby rleibner » Tue Aug 08, 2017 3:28 pm

Salut, clm76 !

You are running an outdated version.
Please download v.:2.1 from the wiki page.
clm76 wrote in Tue Aug 08, 2017 11:37 am:When loading a plane, it can be the default runway which is loaded by Fg but the ATC code can choose another runway as « best »...
So, I modify the code, using the property sim/atc/runway
Well done !

To correct the problem which occurs at LFPG (and possibly in others airport) which is near of LFPB and where it’s LFPG Tower which manages LFPB, I introduced a library of exceptions like this
. . .
There is only LFPG and LFPB in this library but perhaps some others airports in the world have the same managment, So, it’s simple to complete the library.
It’s also possible to create this library outside voice.nas in another file named library.nas or exception.nas…

I agree, but it is preferable to do so in a separate exceptions.xml. So we give the user the possibility to easily add new exceptions without touching the code itself.
More than that, exceptions.xml should have enough flexibility to correct not only icao but also station-ident.
Look e.g. LFPC: it reports 122.10 freq. as "Creil sol" . . . we can understand that, but for the code... :? We should think a little about that.
I think that LSGG case also applies.

So, get down to work! :D
Rodolfo
*************************
Non-shared knowledge is lost knowledge
User avatar
rleibner
 
Posts: 269
Joined: Fri May 19, 2017 8:17 pm
Location: Uruguay - SUMU
Callsign: CX-BEX
Version: next
OS: Ubuntu 18.04.4

Re: Spoken ATC

Postby clm76 » Tue Aug 08, 2017 5:24 pm

rleibner wrote in Tue Aug 08, 2017 3:28 pm:You are running an outdated version.
Please download v.:2.1 from the wiki page.

Can't download, problem with drive.google. Perhaps, we may be registered to download ?

rleibner wrote in Tue Aug 08, 2017 3:28 pm:I agree, but it is preferable to do so in a separate exceptions.xml. So we give the user the possibility to easily add new exceptions without touching the code itself.
More than that, exceptions.xml should have enough flexibility to correct not only icao but also station-ident.
Look e.g. LFPC: it reports 122.10 freq. as "Creil sol" . . . we can understand that, but for the code... :? We should think a little about that.
I think that LSGG case also applies.

It's ok ... you are the boss !... :lol:
clm76
 
Posts: 204
Joined: Tue Oct 30, 2012 9:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2020.4.0
OS: Linux Mint 20.2

Re: Spoken ATC

Postby rleibner » Tue Aug 08, 2017 10:08 pm

clm76 wrote in Tue Aug 08, 2017 5:24 pm:Can't download, problem with drive.google. Perhaps, we may be registered to download ?

Should be public for everyone. Try this link or sendme a PM and I will attach it to you.

There is also the addon version at suorceforge.
Rodolfo
*************************
Non-shared knowledge is lost knowledge
User avatar
rleibner
 
Posts: 269
Joined: Fri May 19, 2017 8:17 pm
Location: Uruguay - SUMU
Callsign: CX-BEX
Version: next
OS: Ubuntu 18.04.4

Re: Spoken ATC

Postby clm76 » Wed Aug 09, 2017 7:22 am

Well downloaded this morning, thanks. :)
clm76
 
Posts: 204
Joined: Tue Oct 30, 2012 9:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2020.4.0
OS: Linux Mint 20.2

Re: Spoken ATC

Postby bugman » Wed Aug 09, 2017 11:10 am

Here are the instructions for obtaining the cutting-edge addon from the official repository (note, I wrote the instructions before the Addons/ directory was added):

Regards,
Edward
bugman
Moderator
 
Posts: 1808
Joined: Thu Mar 19, 2015 10:01 am
Version: next

Re: Spoken ATC

Postby Hooray » Wed Aug 09, 2017 7:50 pm

rleibner wrote in Tue Aug 08, 2017 3:28 pm:I agree, but it is preferable to do so in a separate exceptions.xml. So we give the user the possibility to easily add new exceptions without touching the code itself.
More than that, exceptions.xml should have enough flexibility to correct not only icao but also station-ident.


Just saying that I am inclined to agree with you, if you can come up with some XML-configurable way to deal with this, all the better !
As long as things are properly versioned, it should be easy enough to update things later on.
My only suggestion would be to use an XML structure that you can easily migrate in the future if/when the need arises, i.e. in a semi-automated/scripted fashion.

In general, it would be possible to introduce pre-declared "variables" that are mapped to the navdb/navcahe APIs (findAirportsWithinRange() etc) - e.g. stuff like $AIRPORT, $CALLSIGN etc

these could be dynamically filled in according to the context of the transmissison, and you could use a singler helper function/class to easily map most navdb APIs to such pre-declared variables, and end-users could easily access those without having to be coders.

As a matter of fact, given the degree of progress you have been making with this, you may even want to consider reaching out to the ATCPie/OpenRadar developers to see if/how it may make sense to partially collaborate to some degree, because there is clearly overlapping functionality/requirements here - even if just in terms of data.

And your current XML-based approach could easily become sufficiently flexible to be also of use to ATC clients like ATCPie/OpenRadar.

That is one of the reasons why I previously suggested to introduce XML-level versioning, to make sure that changes to the structure can be easily implemented without necessarily causing breakage.

Sooner or later, some degree of mutual integration/support may become desirable anyway...
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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Spoken ATC

Postby rleibner » Thu Aug 10, 2017 5:58 pm

bugman wrote in Wed Aug 09, 2017 11:10 am:Here are the instructions for obtaining the cutting-edge addon from the official repository (note, I wrote the instructions before the Addons/ directory was added):


Hi Edward,
Thanks for your job. It's a good reference.
May be it's time to update the directions including those "non-aircraft" addons.
Please note that I have not compiled FGFS for a while and cannot check how addon's intallation works. So I do not feel able to write that generalization.

Regards,
Rodolfo
*************************
Non-shared knowledge is lost knowledge
User avatar
rleibner
 
Posts: 269
Joined: Fri May 19, 2017 8:17 pm
Location: Uruguay - SUMU
Callsign: CX-BEX
Version: next
OS: Ubuntu 18.04.4

Re: Spoken ATC

Postby Hooray » Thu Aug 10, 2017 7:46 pm

there is no real "installation" other than extracting the addon into a directory and adding the corresponding --config= option to the fgfs command line
Apart from that, it's really in line with Torsten's previous comments/instructions

that being said, adding an actual "installation" procedure may not be such a bad idea if/when the whole system has become more mature.
I think it was bugman who mentioned already on the devel list that the catalog/package manager infrastructure would be well-suited to also handle the installation/management and removal/updates of such "addons".
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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Spoken ATC

Postby rleibner » Fri Aug 11, 2017 2:55 pm

Hooray wrote in Thu Aug 10, 2017 7:46 pm:there is no real "installation" other than extracting the addon into a directory and adding the corresponding --config= option to the fgfs command line
Apart from that, it's really in line with Torsten's previous comments/instructions

Did you say --config= option ? As Torsten said:
Torsten wrote in Tue Jul 18, 2017 12:03 pm:FlightGear now accepts the command line switch --addon=/path/to/some/addon (note: command line switch is just that: a command line switch - not an option to be entered into the launcher).

I tryed:
Code: Select all
~$ fgfs --addon=/home/rodolfo/SpokenATC
FlightGear:  Version 2017.2.1
FlightGear:  Build Type Dev
Built with GNU C++ version 6.3
Jenkins number/ID 0:none

and got the error msg:
Unknown command-line option: addon
Rodolfo
*************************
Non-shared knowledge is lost knowledge
User avatar
rleibner
 
Posts: 269
Joined: Fri May 19, 2017 8:17 pm
Location: Uruguay - SUMU
Callsign: CX-BEX
Version: next
OS: Ubuntu 18.04.4

Re: Spoken ATC

Postby Hooray » Fri Aug 11, 2017 5:35 pm

That just means that you are using a version that doesn't yet support the new addon option - but config should basically be identical, unless Torsten changed something recently - it's really just an alias IIRC
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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Spoken ATC

Postby wkitty42 » Sat Aug 12, 2017 3:33 am

--addon does specific things in a specific order... --config just reads the xml file and goes... the spoken ATC was modified from its original form to fit into the --addon form... this can be seen in the dev mailing list as well as the repo commits...
"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: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Spoken ATC

Postby Hooray » Sat Aug 12, 2017 8:21 am

It's all neatly preserved in the wiki: http://wiki.flightgear.org/Addons
Like I said, the addon option is still all based on the original approach: https://sourceforge.net/p/flightgear/fl ... 5927ef3ff/

If in doubt, just get a more recent binary ...

If that would take you too long (for whatever reasons), you could alternatively re-structure your code so that it can support both/multiple runtime modes (config, addon, submodules) - this should only require ~20 lines of code to encapsulate the things that are now handled transparently/automatically by the addon option (e.g. using aircraft search paths).
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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Spoken ATC

Postby wkitty42 » Sat Aug 12, 2017 8:15 pm

i think you misunderstood what *I* was saying, hooray... if you were not responding to me, please ignore the rest of this post...

all i was saying is that --addon and --config are very different... while --addon may use --config in the background, it requires certain things to work properly... a config.xml and a main.nas with a main() function to kick things off... --config doesn't require anything other than a xml file...

i also made a slight error... i was thinking of the random atc chatter addon, ATCChatter... its form definitely changed from what it was originally... its readme file needs to be fixed for the new usage, too, as it points to the old method...

in any case, i was simply clarifying that the two options, while similar, are different in specific ways... no more, no less...
"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: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Spoken ATC

Postby Hooray » Sun Aug 13, 2017 2:59 pm

Yes, I am familiar with the approach, in fact, I mentioned it prior to it becoming the "addon" option (like you, in the context of the chatter module being resurrected). I am also familiar with the commits and the postings here and on the devel list, which is why I created the corresponding wiki article. If you are aware of anything that I missed or that could be improved on, it would definitely be great if you could also share your knowledge by editing the corresponding wiki article and adding to it. TIA.
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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

PreviousNext

Return to Nasal

Who is online

Users browsing this forum: No registered users and 4 guests