Board index FlightGear Development Nasal

Nasal based Independant Ramp Marshall

Nasal is the scripting language of FlightGear.

Re: Nasal based Independant Ramp Marshall

Postby Hooray » Wed Aug 07, 2013 7:01 pm

To read from an airport's ICAO.groundnet.xml file, we need to be able to read property attributes from xml. Is there a way we can do that? io.read_airport_properties() doesn't seem to be working at all on the groundnet file.

Is that not a PropertyList-encoded file ? If not, I am wondering why ... but yes, there's Nasal code to deal with arbitrary XML files (and other formats) in io.nas - but I am thinking that the C++ code already processes these files, so it would seem preferable to expose corresponding Nasal bindings instead, instead of replicating the parser logic in scripting space - I yet have to see one of these files, but I believe it would be better to expose ground networks to scripting space. In the long run, features like jetways, the ramp marshall or a follow-me car would all need access to ground networks, and thus ideally be using the same underlying APIs, instead of handwritten parser for different, but similar, purposes. Obviously, a pure Nasal based solution doesn't depend on core changes ...
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: 11329
Joined: Tue Mar 25, 2008 8:40 am

Re: Nasal based Independant Ramp Marshall

Postby Gijs » Wed Aug 07, 2013 7:25 pm

There are plans to move away from the current groundnetwork format anyway (it's FlightGear specific, relies on the unmaintained TaxiDraw which cannot read the new apt.dat), so I wouldn't spend too much time trying to read the current files. I think time is more wisely spent on rewriting the traffic manager to deal with the new X-Plane format. Will have to discuss that with Durk...
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9364
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Nasal based Independant Ramp Marshall

Postby Hooray » Wed Aug 07, 2013 7:30 pm

runways/taxiways can already be processed using Zakalawe's NasalPositioned APIs, so I would think it should be fairly straightforward to also process ground networks and deal with them as "Positioned" objects, that way they would be easily accessible to the AI traffic system, but also to any Nasal code.
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: 11329
Joined: Tue Mar 25, 2008 8:40 am

Re: Nasal based Independant Ramp Marshall

Postby Johan G » Wed Aug 07, 2013 7:44 pm

Two points:
  1. If 4 more joints and 6 more axis per hand* I think almost all hand signals could be used; in essence all the ones not involving other fingers than the thumb. (Would probably add more complexity then needed though.)
  2. I found out that the NATO standard almost never follow the ICAO standard at all where so stated, albeit the latter is a couple of years older. Messy... :roll: (Edited that post to reflect that.)
* One joint and three axis in the wrist, one joint and axle on the thumb and two mirrored/linked joints and axis (i.e. moving them together -180 deg, would move each -90 deg) in the palm.
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 5509
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit

Re: Nasal based Independant Ramp Marshall

Postby omega95 » Thu Aug 08, 2013 4:48 am

Hmm, so you said you don't want to mess with the thumb and fingers. I wanted it to be able to do a thumbs up so I made a thumbs up model and we coud just hide the hand with the wand, both the wands on the other hand and show the thumbs up but it didn't seem to be worth the troubles, form the ICAO annex 2, you can just put the right wand up over your head to signal that everything's ok.

So, other than the hands, what joints are you talking about? I understood 3 axes on the wrist = 1joint. Do you need anymore axes on the other joints (shoulder ane elbow)? I think the elbow is fine because humans can only flex their elbow in 1 axis. For the shoulder, we could put a y-axis too.

And what are your your thoughts on using xml to store the marshaller's signals and sequence? I think it would limit some options but might some people find that easier to use? For example, in an xml file, we can have positions and sequences. A position tree would have something like -

Code: Select all
<pos n="0">
    <name>hands-out-fwd</name>
    <left>
        <shoulder>
            <x-deg>0</x-deg>
            <y-deg>-90</y-deg>
            <z-deg>0</z-deg>
        </shoulder>
        <elbow>
            <x-deg>0</x-deg>
        </elbow>
        <hand>
            <x-deg>0</x-deg>
            <y-deg>0</y-deg>
            <z-deg>0</z-deg>
        </hand>
    </left>
    <right>
        <shoulder>
            <x-deg>0</x-deg>
            <y-deg>90</y-deg>
            <z-deg>0</z-deg>
        </shoulder>
        <elbow>
            <x-deg>0</x-deg>
        </elbow>
        <hand>
            <x-deg>0</x-deg>
            <y-deg>0</y-deg>
            <z-deg>0</z-deg>
        </hand>
    </right>
</pos>


And define a fixed system to parse sequences. Again like I said, this won't give us the freedom nasal does to define sequences. For example, this would be something like - bring hands to rest, lift to hands-out-fwd position, wait for 2 seconds and bring it back down.

Code: Select all
<signal n="0">
    <name>do_something</name>
    <sequence>
        <position>
            <name>rest</name>
            <wait>0</wait> <!-- or use wait-prop and wait-value to wait for a property to reach a value -->
        </position>
        <position>
            <name>hands-out-fwd</name>
            <wait>2</wait>
        </position>
        <position>
            <name>rest</name>
            <wait>0</wait>
        </position>
    </sequence>
</signal>


I mean, for now, you have to do the following for each step in nasal, but if we did this in xml, I think a lot of others would find it easier to work with when creating signals. :)

Code: Select all
if(me.phase == 0) {
    if(!check_pos(ramp_tree, pos.hands_out_front)) {
   full_animate(ramp_tree, pos.hands_out_front, 100);
    } else {
        me.phase = 1;
    }
}


The good thing about using xml is that we can make many signals and they're all simplifed. :)

So I added an axis to the shoulder join and 3 axes to the hand joint so far. :)

Code: Select all
var rmPos = {
   lA_x: 0,
   lA_y: 0,
   lA_z: 0,
   lAO_x: 0,
   lH_x: 0,
   lH_y: 0,
   lH_z: 0,
   rA_x: 0,
   lA_y: 0,
   rA_z: 0,
   rAO_x: 0,
   rH_x: 0,
   rH_y: 0,
   rH_z: 0,
   new: func(lA_x, lA_y, lA_z, lAO_x, lH_x, lH_y, lH_z, rA_x, rA_y, rA_z, rAO_x, rH_x, rH_y, rH_z) {
      var m = { parents: [rmPos] };
      m.lA_x = lA_x;
      m.lA_y = lA_y;
      m.lA_z = lA_z;
      m.lAO_x = lAO_x;
      m.lH_x = lH_x;
      m.lH_y = lH_y;
      m.lH_z = lH_z;
      m.rA_x = rA_x;
      m.rA_y = rA_y;
      m.rA_z = rA_z;
      m.rAO_x = rAO_x;
      m.rH_x = rH_x;
      m.rH_y = rH_y;
      m.rH_z = rH_z;
      return m;
   }
};


Code: Select all
var pos = {
    # TEMPLATE: rmPos.new( lA_x,  lA_y,  lA_z, lAO_x,  lH_x,  lH_y,  lH_z,  rA_x,  rA_y,  rA_z, rAO_x,  rH_x,  rH_y,  rH_z);
   rest:       rmPos.new(   80,     0,     0,     0,     0,     0,     0,   -80,     0,     0,     0,     0,     0,     0),
   stop:       rmPos.new(  -55,     0,     0,   -70,     0,     0,     0,    55,     0,     0,    70,     0,     0,     0),
   fwd_out:    rmPos.new(    0,     0,   -50,   -30,     0,     0,     0,     0,     0,    50,    30,     0,     0,     0),
   fwd_in:     rmPos.new(    0,     0,   -50,  -120,     0,     0,     0,     0,     0,    50,   120,     0,     0,     0),
   left_in:    rmPos.new(    0,     0,     0,  -120,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0),
   left_out:   rmPos.new(    0,     0,     0,   -30,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0),
   right_in:   rmPos.new(    0,     0,     0,     0,     0,     0,     0,     0,     0,     0,   120,     0,     0,     0),
   right_out:  rmPos.new(    0,     0,     0,     0,     0,     0,     0,     0,     0,     0,    30,     0,     0,     0)
};


Btw, I was wondering if we can compare 2 hashes with same data instead of comparing each of the variables in them. :)
Merlion Virtual Airlines - the experience of a flight time...
Get high quality aircraft, airports, video tutorials or development tools from my hangar.
omega95
 
Posts: 1223
Joined: Sat Jul 30, 2011 12:59 am
Location: -unknown-
Callsign: MIA0001, OM-EGA
IRC name: omega95
Version: 2.12 git
OS: Ubuntu 13.04

Re: Nasal based Independant Ramp Marshall

Postby Hooray » Thu Aug 08, 2013 12:17 pm

agreed, most people here will find the XML-based route much more intuitive to work with - on the other hand, there's nothing stopping you from using XML while supporting embedded Nasal sections for added flexibility, that's how many other XML files work in FlightGear, too - for example, look at the tutorial system, all implemented in Nasal, it's all XML with embedded Nasal sections: http://wiki.flightgear.org/Tutorials
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: 11329
Joined: Tue Mar 25, 2008 8:40 am

Re: Nasal based Independant Ramp Marshall

Postby Philosopher » Thu Aug 08, 2013 12:23 pm

Hey guys, I already have a different system for animations that I'll push later this morning, it's a lot easier and is almost a DSL (besides the fact that it's specified in Nasal variables).

Btw, I was wondering if we can compare 2 hashes with same data instead of comparing each of the variables in them.

Nope :P
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: Nasal based Independant Ramp Marshall

Postby omega95 » Thu Aug 08, 2013 1:27 pm

I'll push later this morning, it's a lot easier and is almost a DSL


I was wondering if you could get it up asap, I was thinking of doing some work on it and I don't want to create any conflicts. :)
Merlion Virtual Airlines - the experience of a flight time...
Get high quality aircraft, airports, video tutorials or development tools from my hangar.
omega95
 
Posts: 1223
Joined: Sat Jul 30, 2011 12:59 am
Location: -unknown-
Callsign: MIA0001, OM-EGA
IRC name: omega95
Version: 2.12 git
OS: Ubuntu 13.04

Re: Nasal based Independant Ramp Marshall

Postby Philosopher » Thu Aug 08, 2013 1:34 pm

Testing it right now ... the little guys went on strike again, I'll have to see what's up :(

Edit: done! Problem was /sim/enable-ramp-marshall :), I have now pushed my changes to Gitorious along with the complete history of the FlightGear Data repository :).
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: Nasal based Independant Ramp Marshall

Postby omega95 » Thu Aug 08, 2013 1:49 pm

Btw, while you do that, I'll get the xml config system working. I was wondering how we can execute a nasal script stored in xml tags though. :)

Oh and what happened to the commits I made today? They're all gone... :

And that's a pretty nice animation system, makes stuff a lot easier! But like Hooray said, I thought we were going to put the configs in xml. :| I mean, we could read the properties into the tree and then create the anim and pos hashes on startup. (Slightly modified though)

Btw, it you don't seem to have the arm-y and hand axes in full_animate and check_pos anymore...
Merlion Virtual Airlines - the experience of a flight time...
Get high quality aircraft, airports, video tutorials or development tools from my hangar.
omega95
 
Posts: 1223
Joined: Sat Jul 30, 2011 12:59 am
Location: -unknown-
Callsign: MIA0001, OM-EGA
IRC name: omega95
Version: 2.12 git
OS: Ubuntu 13.04

Re: Nasal based Independant Ramp Marshall

Postby Hooray » Thu Aug 08, 2013 2:10 pm

Philosopher wrote in Thu Aug 08, 2013 1:34 pm:I have now pushed my changes to Gitorious along with the complete history of the FlightGear Data repository :).


yikes, dude ... philosopher pushed 16789 commits - I suggest to read up on "git pull --rebase" and "git rebase" (see the wiki for examples) :D
EDIT: I think something else is going on here, 16k commits doesn't make any sense at all - unless you didn't add omega95's repo as a remote to fgdata ?
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: 11329
Joined: Tue Mar 25, 2008 8:40 am

Re: Nasal based Independant Ramp Marshall

Postby Philosopher » Thu Aug 08, 2013 2:23 pm

Omega: I merged this commit in manually. (It became a different commit though, namely this one.) Were there any others? If so, they didn't get pushed to gitorious.

Lol, okay, so what happened is that omega's "fgdata" clone is essentially just his files that he changed (that's, um, how he does his workflow). What Gijs said about the merge request changing every line is essentially true - but the reason is that the file never existed in omega's commit history before (since he had no commits) and so it's just a new file. (Evidently this still can get merged into fgdata....) So I made the repo a proper clone (those 16k commits are all verbatim fgdata) after merging our repos - this makes it easier for me since I use Git fgdata as-is (I add scenery and aircraft separately, my joystick sub-repo gets passed over by the black cloud of checking out, and so i'm good). Now this makes things complicated since he wants it back as it was (he likes copying the file over? well, he probably just has a heavily modified fgdata by now) and so I will now have to merge my new commits back into the old non-fgdata-ish-thing branch. Which I can do, given a few minutes ... (the latest commit will still disappear and I'll have to do another push -f, which is my fault since I didn't think of using git to merge the commit in)

Edit: should be done, let me know how it works. You still might have to start afresh, but make you you AREN'T GOING TO LOSE ANYTHING!!
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: Nasal based Independant Ramp Marshall

Postby omega95 » Thu Aug 08, 2013 2:41 pm

Oh wow, ok - seems to be fine now, sorry about that - like you said, I have a lot of stuff modified in my fgdata (Aircraft and Scenery are separate but I use flightgear for purposes other than flying - *hint* great platform for robotic experiments and logged data testing)

Sorry this is out of topic, but behold the flying turtle! :mrgreen:

Image

@Philosopher - I'm really sorry about that, is there a way I can just pull the ramp marshall files though? :)

Thanks a lot for you help.

And I'm not sure if you missed this, but -

I was wondering how we can execute a nasal script stored in xml tags though. :)
Merlion Virtual Airlines - the experience of a flight time...
Get high quality aircraft, airports, video tutorials or development tools from my hangar.
omega95
 
Posts: 1223
Joined: Sat Jul 30, 2011 12:59 am
Location: -unknown-
Callsign: MIA0001, OM-EGA
IRC name: omega95
Version: 2.12 git
OS: Ubuntu 13.04

Re: Nasal based Independant Ramp Marshall

Postby Philosopher » Thu Aug 08, 2013 2:54 pm

omega95 wrote in Thu Aug 08, 2013 2:41 pm:Sorry this is out of topic, but behold the flying turtle! :mrgreen:

Haha, lovely!

Um, well, depends on what you need it for. With my animation-format update you should be able to specify anything using just XML - no need to manually code the Nasal code to change the position we're moving to anymore. (Actually, I'd be willing to write a DSL for that.) But if you do need to compile a Nasal bit of code, use compile() - compile(str[, name]) generates a func who's contents are str (like func {*str} if you could use the *-prefix operator to embed the contents of the string into the code), and then you call that (you can use call(func[, arg[, me[, namespace[, var err = []]]]]) to call it in a specific namespace, or just a regular function call it in it's own namespace). I have a method for making macros (functions that are run inline) if you want... Another option is using <bindings>, but I suspect that is not what you want to use them for? I'll need more infos to help you more...
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: Nasal based Independant Ramp Marshall

Postby omega95 » Thu Aug 08, 2013 3:17 pm

Ahh yes, I'm using your code but writing a loader that opens the signals xml file and converts the data into the pos and anim hash formats so your animation code and read it. :)

As for reading nasal from xml, well I was hoping we could get some nasal code in xml tags and it gets converted to a funtion. I think you're telling me exactly what I need, but do you have an example or is this in the wiki? :)
Merlion Virtual Airlines - the experience of a flight time...
Get high quality aircraft, airports, video tutorials or development tools from my hangar.
omega95
 
Posts: 1223
Joined: Sat Jul 30, 2011 12:59 am
Location: -unknown-
Callsign: MIA0001, OM-EGA
IRC name: omega95
Version: 2.12 git
OS: Ubuntu 13.04

PreviousNext

Return to Nasal

Who is online

Users browsing this forum: No registered users and 3 guests