Board index FlightGear Development Nasal

Nasal based Independant Ramp Marshall

Nasal is the scripting language of FlightGear.

Re: Nasal based Independant Ramp Marshall

Postby Gijs » Wed Aug 07, 2013 2:32 pm

Looks like a fun feature! It certainly adds some life to our mostly static airports :-)

VaLeo actually made something similar for a russian airport several years ago. You can find it at http://valeo.flightgear.ru/sshot/marshall/ and more info in the topic viewtopic.php?p=125510#p125510 Might be useful reference material.

I don't have time to test it today, but I do have some comments that I think are best shared early:
  • your merge request seems to change the indentation, thus touching every single line of files like 747-400-set.xml. This makes it very hard to see what you've changed.
  • scenery models and airport data (jetways, ramps) should not be pushed to Git, but directly to the scenery database. Git is synched with the scenery database (not the other way around!) before each release.
  • your work won't make it into 2.12, as that version is frozen for new features as of July 17. This means that you can spend some more time to make sure it's done properly. Might make sense to wait for Hooray to comment on your Nasal code for example.
  • did you think of placing the marshaller based on the groundnetwork? With the heading, center and radius of the parking spot, one could easily position the marshaller in front of the aircraft. Would be a lot easier to maintain than yet another data format. Aditionally it could be wise to see how/if X-Plane handles this. Taxi routes and parking spots are part of newer apt.dat formats after all, so we will likely go down that route one day.

Cheers,
Gijs
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9544
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Nasal based Independant Ramp Marshall

Postby omega95 » Wed Aug 07, 2013 2:59 pm

Haha, VaLeo's seems to be pretty cool. I'll take a look at his to find out more about using parking sports from the groundnet but for now, I'd rather have it on a separate file. Not all airports have good parking files and not all parking spots should have marshallers. I was thinking of maybe making a nasal based converter that generates a ramp position file from a specified groundnet instead of reading off just 1 file.

your merge request seems to change the indentation, thus touching every single line of files like 747-400-set.xml. This makes it very hard to see what you've changed.


I've added the following code in line 55 -
Code: Select all
<ramp>
    <x-m type="float">-22.5</x-m>
    <class type="string">0</class>
</ramp>


Hmm, so what about the files in AI/Airport? Are then from the scenery database too?

And do I have to use http://scenemodels.flightgear.org/submission/static/index.php to add the whole airport (WSSS - it's not done yet, I'm just asking for later) to the scenery db? This seems like a very time-consuming process considering the number of models. Is there a faster way to do this?

If not, I'm starting to get why a lot of nice airports are not in the scenery db. :shock:
Merlion Virtual Airlines - the experience of a flight time...
Get high quality aircraft, airports, video tutorials or development tools from my hangar.
omega95
 
Posts: 1222
Joined: Sat Jul 30, 2011 1: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 » Wed Aug 07, 2013 3:13 pm

Also, I cloned the merge request into a new fgdata branch (that was based off of master) and got merge conflicts for the places you changed in those -set.xml files (which was weird, since nothing existed there in the HEAD/master).
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Nasal based Independant Ramp Marshall

Postby Gijs » Wed Aug 07, 2013 3:27 pm

omega95 wrote in Wed Aug 07, 2013 2:59 pm:Not all airports have good parking files and not all parking spots should have marshallers.

Right. We could then add a tag to the groundnets to enable/disable the marshaller. The fact that we don't have groundnets for every single airport yet doesn't justify adding another file with (roughly) the same kind of data IMO.

Hmm, so what about the files in AI/Airport? Are then from the scenery database too?

Yes. Since some time (two or three releases back I think) we extract the groundnetworks etc from $FG_SCENERY/Airports/.

And do I have to use http://scenemodels.flightgear.org/submission/static/index.php to add the whole airport

In principle yes, as it is the easiest for the maintainers. From a scenery creator point of view it would be nice to just dump your stuff and let the maintainers handle everything, but you can imagine that's not nice from a maintainer point of view :-) You could ask f-ojac if there's another possibility though, he has direct access.

If not, I'm starting to get why a lot of nice airports are not in the scenery db.

The tools have improved a lot over the past year, but I won't deny there's more work to be done. The website code is available at http://gitorious.org/fg/sceneryweb, so you're welcome to help us optimising it.
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9544
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Nasal based Independant Ramp Marshall

Postby Hooray » Wed Aug 07, 2013 3:31 pm

omega95 wrote in Wed Aug 07, 2013 9:40 am:Just made some aircraft (most from my hangar and a couple others from fgdata) compatible with the ramps!

Could you please add a brief write-up about the necessary steps to the wiki: http://wiki.flightgear.org/Ramp_Marshall
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: Nasal based Independant Ramp Marshall

Postby omega95 » Wed Aug 07, 2013 3:43 pm

Right. We could then add a tag to the groundnets to enable/disable the marshaller.


Alright, I'll play around with that tonight! :D

The website code is available at http://gitorious.org/fg/sceneryweb, so you're welcome to help us optimising it.


That's awesome! I was thinking of having separate airport directories inside the Models folder for scenery models specific to that airport (not vehicles, only terminal buildings and stuff like that) and have the ability to upload a full airport directory. (upload as a zip file) This is only for the models, I'm pretty happy with the position data uploader for now. :)

So, If I play around with the website in a separate host and get it to do this, will there be any chance of my updates going to the current scenemodels website? Do I just create a merge request with my changes?

Could you please add a brief write-up about the necessary steps to the wiki: http://wiki.flightgear.org/Ramp_Marshall


I'm on it! :)
Merlion Virtual Airlines - the experience of a flight time...
Get high quality aircraft, airports, video tutorials or development tools from my hangar.
omega95
 
Posts: 1222
Joined: Sat Jul 30, 2011 1: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 » Wed Aug 07, 2013 4:07 pm

Here's some more feedback based on going through your merge request briefly:
  • separate merge requests are a good idea
  • some variables at the beginning of the script aren't using the var keyword?
  • the script seems to replicate a fair amount of code in two places: $FG_ROOT/Nasal/ramp_marshall.nas and Models/Airport/Ramp/ramp_marshall.nas ?
  • make sure that your code handles reset/re-init and repositioning properly, i.e. remove any running timers/listeners then
  • some people are not happy about the way jetways are working, because it means that Nasal code may get triggered by the tile manager - in other words, it would be a good idea to provide a flag to disable ramp agent support through a single property switch, which also allows people to more easily investigate potential performance issues by disabling the code.

There's also the old issue with objects using the me keyword without ever instantiating an object with a parents vector (P: see the main_loop hash), I have seen that in various places (even tutorials), I am not even 100% sure if it's correct or if/why it works ... I suggest to have another look once Philosopher has found some time to go through the Nasal code, in other words: just consider him our Nasal expert - it's pretty safe to say that we don't have anybody else actively involved in the project who knows as much about Nasal and its internals as Philosopher, so listen to him! :D
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: Nasal based Independant Ramp Marshall

Postby Philosopher » Wed Aug 07, 2013 4:19 pm

"me" is just the left side of the dot in a class.foo() expression. (No, I am more than that...) It's guaranteed to be either a hash or non-existent, but as it's *just* the left-hand side it can really point to any hash that has the function as a member or remote-member (remote meaning that it can be found via the parents recursion). I wouldn't call it an issue though, just a feature - see the aircraft.data "class". Quoting: "there's no public constructor as the only needed instance is created by the system" (lol, got that off the top of my head and it was right!). So in that case we don't need an instance (aka: var m = { parents:[class] }), but it is still awfully convenient to use the "me" reference to keep things encapsulated, and it works out to be a class anyways. This, of course, is a bit of a trust issue, as it relies on the fact that it must be called with the right syntax (data.add or aircraft.data.add, versus a myriad of wrong ways to call it), but as that is the common syntax, it works out O.K.
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Nasal based Independant Ramp Marshall

Postby omega95 » Wed Aug 07, 2013 5:11 pm

Models/Airport/Ramp/ramp_marshall.nas ?


Ahh darn, forgot to delete that file! I just moved the folder from my WSSS project straight into here.

make sure that your code handles reset/re-init and repositioning properly, i.e. remove any running timers/listeners then


Well, I've reloaded FlightGear (Reset and Reload Scenery) plenty of times and there weren't any problems. It sets a loaded flag in the airport's property tree so it doesn't load them again. :)

provide a flag to disable ramp agent support through a single property switch


Alright, I'll do that. :) So, do you want to also put a checkbox under Animated Jetways for the Ramp Marshall script? So far, I haven't seen any major performance difference (frame-rates are in the same range as they were efore) with the ramp-marshalls. And unlike the jetways, only 1 of the ramp marshalls can be activated at a time (because only one's required at a certain time!) so it makes stuff a lot simpler. :)

Philosopher, so listen to him! :D


Haha, ofcourse!

I used to think "me." points to the class/hash it's used in. (like $this-> in PHP) I would also think that it works like that because I've used that before with the ATR 72. For example, if there's a function in a hash and I've created an instance of it, me.<some variable name> points to the variable stored in the instance.

Would you recommend I do anything about it though? I use "me" to keep the variable stored.

some variables at the beginning of the script aren't using the var keyword?


Are you talking about the variables with the me keyword? I can't seem to find anything without vars.

Thanks a lot for you help (as always)! :D
Merlion Virtual Airlines - the experience of a flight time...
Get high quality aircraft, airports, video tutorials or development tools from my hangar.
omega95
 
Posts: 1222
Joined: Sat Jul 30, 2011 1: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 » Wed Aug 07, 2013 5:36 pm

yeah, Nasal's "me" keyword is the this pointer equivalent in Nasal, but I was referring to singleton-uses where objects are never really created by setting up a hash with a parents vector, but where "me" is still accessed as is. I still have to check how that really works under the hood ... like P. says, it seems to be a common construct in FG, which is to be found in various places ...
Supporting multiple instances (at the same time) would seem like a good idea - conceptually, even AI traffic could honor such scripted ramp agents - definitely any scripted AI traffic that uses Nasal.
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: Nasal based Independant Ramp Marshall

Postby Philosopher » Wed Aug 07, 2013 5:45 pm

Look at codegen if you need to.

Anyways, I guess the point I forgot (I always forget one) was that it works like this-> in whatever language you want - but it can be prone to error if the caller does something stupid. (It actually more closely resembles "self" in python, in that the caller can mess with it, but with python and its duck typing you wouldn't know ;).)

P.S. It does support multiple people at a time.
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Nasal based Independant Ramp Marshall

Postby omega95 » Wed Aug 07, 2013 6:18 pm

P.S. It does support multiple people at a time.


Are you talking about the marshaller? That can't be right! The script will change the active marshaller (there is only 1 active-ramp property) to the one that's clicked, or if he's already active, he'll be deactivated.

I mean, multiple ramp marshallers will be there but only 1 will guide the pilot at a time. :|
Merlion Virtual Airlines - the experience of a flight time...
Get high quality aircraft, airports, video tutorials or development tools from my hangar.
omega95
 
Posts: 1222
Joined: Sat Jul 30, 2011 1: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 » Wed Aug 07, 2013 6:34 pm

Oh sorry, didn't examine that closely (doesn't help that I can't see the guy when he tells me to stop, the 747 is just sooo tall). But I'm not sure i like the idea actually, it seems like a waste to me to have AI use it ?
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Nasal based Independant Ramp Marshall

Postby omega95 » Wed Aug 07, 2013 6:58 pm

the 747 is just sooo tall

Which is why you lean forward. In my A330 parking video, I "walked" forward but you could just as well go to adjust view position and play around till you can see the marshaller. :mrgreen:

it seems like a waste to me to have AI use it

Exactly! AI's don't need anyone to guide them in, lol! I mean, it would just be eye-candy and because the marshaller is so small, (average human heigh though) you'll barely be able to see him from your aircraft.

Btw, I closed the merge request (created a separate one for the gui style and styler), so we can refine the ramp marshall code and like Gijs said, get position data from the groundnet file. (If a ramps file isn't defined, I guess?)

I'm working on the ramp marshaller in this branch - https://gitorious.org/~omega95/fg/omega95s-fgdata/commits/rampmarshall :)

---------------------------------------- EDIT -------------------------------------

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.
Merlion Virtual Airlines - the experience of a flight time...
Get high quality aircraft, airports, video tutorials or development tools from my hangar.
omega95
 
Posts: 1222
Joined: Sat Jul 30, 2011 1: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 » Wed Aug 07, 2013 7:39 pm

omega95 wrote in Wed Aug 07, 2013 6:58 pm:
it seems like a waste to me to have AI use it

Exactly! AI's don't need anyone to guide them in, lol! I mean, it would just be eye-candy and because the marshaller is so small, (average human heigh though) you'll barely be able to see him from your aircraft.


Not disagreeing, but it's one of the most straightforward ways to implement (and test!) support for multiple instances - i.e. imagine multiplayer support, where various airliners would each have their own instance. A truly generic design would support all of these use-cases, with very little code.

Historically, FlightGear has been developed with a focus on a single main aircraft, which is why more and more features are broken once multiple instances need to be synchronized, no matter if it's just multiplayer or master/slave setups - where each slaved view would need a properly synchronized AI entity, no matter if it's AI aircraft, weather or a ramp marshall. We already have tons of features that break existing features because people are not actively working towards fixing such issues. For the same reasons, we are not able to switch aircraft at runtime or save/load flights properly - people always think in terms of just a single use-case, rather than in broadest of terms. Just don't complain when the next guy comes here posting that feature XYZ (such as replay/flight recorder) doesn't properly work with jetways and/or ramp marshalls :lol:
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 2 guests