Board index FlightGear Development Nasal

Nasal based Independant Ramp Marshall

Nasal is the scripting language of FlightGear.

Re: Nasal based Independant Ramp Marshall

Postby Philosopher » Thu Aug 08, 2013 4:27 pm

You'll have to show me what you want to do... And yes, I stated it illegibly :)
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Nasal based Independant Ramp Marshall

Postby omega95 » Thu Aug 08, 2013 4:43 pm

Small problem here - I pulled the ramp-marshall-base branch (only that) using -

Code: Select all
git pull origin ramp-marshall-base


And it worked fine. I got
Code: Select all
remote: Counting objects: 37, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 29 (delta 12), reused 8 (delta 6)
Unpacking objects: 100% (29/29), done.
From gitorious.org:~omega95/fg/omega95s-fgdata
 * branch            ramp-marshall-base -> FETCH_HEAD
Auto-merging Nasal/ramp_marshall.nas


But now, when I try
Code: Select all
git push origin ramp-marshall-base

after the commits, I get -
Code: Select all
error: src refspec ramp-marshall-base does not match any.
error: failed to push some refs to 'git@gitorious.org:~omega95/fg/omega95s-fgdata.git'


Code: Select all
git checkout ramp-marshall-base

returns the same thing... :|
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 » Thu Aug 08, 2013 4:46 pm

Your local branch is still named rampmarshall - git branch -m ramp-marshall-base to fix (if you're in the rampmarshall branch)
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Nasal based Independant Ramp Marshall

Postby omega95 » Thu Aug 08, 2013 5:02 pm

Great, that did it - thanks! :D

Anyway, it seems to work fine now. It still uses your code for stepped animation but there aren't any positions in the hases at startup, they're loaded from the xml - so it's easy to add positions and signals. Other function codes still need to be added in the nasal file - there isn't a condition xml tag yet but I'm thinking of making one. Then a user can add signals by only playing with the xml file.

As for the xml encoded nasal, the script will be something like this-

Code: Select all
<signal>
    <name>eng_start</name>
    <type>nasal</type>
    <script>
        # Nasal Script here
    </script>
</signal>

And when the function is eng_start, it should run the nasal script. :)


Currently, only the type - 'steps' is accepted but I want to get nasal working too.
And then if the type is 'steps', each step can have one of the following actions now - animate, hold-pos (appends nil the the anim.<signal_name> vector) and jump-to (appends the step the jump to). But I'm thinking of adding support for 2 more - wait-time, where the marshaller holds his hands out at that position for a certain amount of time before going to the next step, and wait-prop where he holds the position until a property reaches, exceeeds or is less than a certain specified value. :) I suppose we could add ands and ors in there too for some better logic. 8)

This would be useful when the marshaller only keeps his wands in a cross (stop pos) until the aircraft's groundspeed is 0 and then brings it to rest or even gives an acknowledgement signal. :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 » Thu Aug 08, 2013 5:19 pm

  • read in the XML file (you already know how to do that)
  • get the script section, read it into a string (you already know how to do that)
  • see Philosopher's earlier posting and use compile() to turn the script section into a Nasal function that you can actually call
    Subject: Nasal based Independant Ramp Marshall
    Philosopher wrote:
    omega95 wrote in Thu Aug 08, 2013 3:41 pm:Sorry this is out of topic, but behold the flying turtle! :mrgreen:

    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).
  • compile() returns a func
  • you can now call the function

Example:

Code: Select all
var string = " print('hello'); "
var code = compile(string);
code();


there isn't a condition xml tag yet but I'm thinking of making one. Then a user can add signals by only playing with the xml file.

see props.nas it already supports SGConditions
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 » Thu Aug 08, 2013 7:19 pm

Great, that works perfectly - again thank you very much! :D



Testing the engine start animation script - which is embeded in the xml signals file. I'll push these changes ASAP. 8)

Someone (I will tomorrow, if no one else is willing to) has to change the stuff in the wiki though. :roll:
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 » Fri Aug 09, 2013 1:55 am

Instead of using a <type> tag here, I would be tempted to do this based on checking if it has a certain child or not (note that multiple of these could probably be used together):
  • If it has steps tag then generate a anim entry for it.
  • If it has a <binding>, run that when the function is switched to (this is instead of <type>nasal</type><script>...</script>, since I believe bindings are essentially what you are doing anyways and they would even be more generic).
  • If it has a <wait> then:
    • if it has a <condition> and an <update-interval>, wait for that condition, checking every update-interval-seconds
    • elsif it just has a <condition>, check every frame
    • elsif it has a <time>, then wait for that long

Would this work?
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Nasal based Independant Ramp Marshall

Postby omega95 » Fri Aug 09, 2013 4:30 am

If it has a <wait> then:

Hold on, wait is something that's going to be inside steps, so what about if the action is wait?
Then, I suppose we could go with condition, condition and update-interval and time tags inside it. :)

Also, getting rid of the type tag is a nice idea, but how exactly do I check if a tag exists? :oops:

And yes, you're right - that would be much better.
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 » Fri Aug 09, 2013 4:47 am

Oh yeah, I got confused there, wait should be a child of a step. Anyways, to check for a child in a node: «n.getNode("steps") != nil» (we should really port the hasChild predicate when we go to cppbind...). In python it would be: «"steps" in n» ;).
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Nasal based Independant Ramp Marshall

Postby Johan G » Fri Aug 09, 2013 10:57 pm

omega95 wrote in Thu Aug 08, 2013 5: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.

It is more or less only for the break signal and for the thumbs up in the ICAO system, but specially the thumbs are used more in the NATO system. I guess the signals uses more of the hand when you one is sitting in a jet fighter instead of a jet-liner and get closer to the marshaller :wink:

omega95 wrote: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.

They are all in (or is it on) the hand, using the thumbs would require one joint and axle and closing the palm for e.g. the "engage breaks" signal would, to look ok, require two joints and axles (in essence I meant that there is an axle through each joint, which may have been confusing and possibly is not the correct use of those words).

As for the wrists they are needed for many signals used by NATO (for example signals used during preflight checks, like extending and retracting flaps and air brakes, telling that various ground equipment like GPU and telebrief has been connected etc) .

omega95 wrote: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...

...

And define a fixed system to parse sequences. Again like I said, this won't give us the freedom nasal does to define sequences...

That looks ok to me so far. Nasal is still a bit over my head (though copy-pasting should not be impossible either).


Thank you so far. :D
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)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Nasal based Independant Ramp Marshall

Postby omega95 » Sat Aug 10, 2013 4:09 am

Well, that's perfect! The marshaller has 6 joints now - shoulders (3-axis) , elbows (1-axis) and hand-forearm-joints. (3-axis) I would think moving each finging separately is a little painful but like I said earlier, we could just make different models of hand positions and select through them. :)

So, if we're going to follow the NATO hand signals (will need to change some stuff then), what signals do you think we should teach the marshaller? And now, it's in xml, so it should be pretty stright forward. The signals file has positions and signals, the brief comments and examples should be easy to understand but let me know if you need anything else! :)
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 Johan G » Sat Aug 10, 2013 1:47 pm

After viewing some dozens of of startup and taxi videos with various jet fighters on YouTube (several of each of F-16, F-18, T-38, T6 II and a few others) I am starting to have second thoughts about implementing NATO signals. It appears that signals actually used is very related to each type of aircraft, except for the very basic ones like taxi forward, turn, normal stop and fast stop signals. :roll:

Most modern fighters seem to use headphones connected to the aircraft and more modern aircraft do not need that much ground support equipment apart from the ladder. That being said hand signalling is still used to some extent but often involves a few fingers as well. But as I said I'm having second thoughts. Maybe some some aircraft will have them at a later point as something happening outside when doing full startup and shutdown checklists. I say leave it for later. :wink:
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)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Nasal based Independant Ramp Marshall

Postby Philosopher » Sat Aug 10, 2013 4:10 pm

Hey, how about using /gear/gear[0]/xoffset-in if the aircraft doesn't define /sim/model/ramp/x-m ? It's the front nosegear or one of the mains for taildraggers.
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Nasal based Independant Ramp Marshall

Postby omega95 » Sat Aug 10, 2013 4:47 pm

Aha! So that's where the property is! I was looking for it in the /fdm tree. :oops:
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 TheTom » Mon Aug 19, 2013 10:16 pm

/gear/gear[0] is no necessarily the a front gear. Here is a snippet from my VDGS to get the offset of the front most gear (retracted and on ground):

Code: Select all
# check for front gear anytime _nlg_offset is set to zero
if( me._nlg_offset == 0 )
{
  me._nlg_offset = 0.01; # ensure it does not stay 0
 
  # get distance of nose wheel to center
  # we assume that the foremost gear is the nose landing gear
  for(var i = 0; 1; i += 1)
  {
    var n = props.globals.getNode("/gear/gear[" ~ i ~ "]");
    if( n == nil )
      break;
    if(    !n.getValue("wow")
        or  n.getValue("position-norm") != 1.0 )
      continue;

    var x = n.getValue("xoffset-in") * IN2M;
    if( x > me._nlg_offset )
      me._nlg_offset = x;
  }
}
TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 11:20 am

PreviousNext

Return to Nasal

Who is online

Users browsing this forum: No registered users and 5 guests