Board index FlightGear Development Nasal

Property tree questions - position/gear-agl-m ?

Nasal is the scripting language of FlightGear.

Property tree questions - position/gear-agl-m ?

Postby ot-666 » Sun Jul 04, 2010 2:18 pm

Currently I try to make the vmx22 downwash effect working over MP. Getting the door movements visible over mp works nice by reading the property tree for the door and writing it to “sim/multiplay/generic/float[x]” in the update loop for the use over mp.

my problem:
The downwash effects use the “position/gear-agl-m”, but if I try to get this value from the property tree with

Code: Select all
var gear_magl = props.globals.getNode("position/gear-agl-m", 1);

I get no value. Accessing this value in the v22.xml works. Why do get no value if I try to access this property with nasal?

Where do I find a list of the properties that are supported by the mp-protocol? I had a look in the mp documentation, but I could not find anything.

Best regards, Oliver
Callsign: ot-666
Working on LOWI and other stuff - Custom Scenery Overlay Repo: http://gitorious.org/fgfs-custom-scenery/custom-scenery-overlay/
VMX22 - Osprey... sometimes in 2014
ot-666
 
Posts: 746
Joined: Sun Nov 08, 2009 6:14 pm
Location: Germany, Konstanz
Callsign: ot-666
IRC name: ot666
Version: GIT
OS: win7 64bit

Re: Property tree questions - position/gear-agl-m ?

Postby HHS » Sun Jul 04, 2010 3:10 pm

A lot of properties aren't supported. But you can use “sim/multiplay/generic/float[x]” as well for that I guess.
Up, up and away
User avatar
HHS
 
Posts: 3625
Joined: Thu Jul 19, 2007 9:09 am
Version: GIT

Re: Property tree questions - position/gear-agl-m ?

Postby AndersG » Sun Jul 04, 2010 3:19 pm

ot-666 wrote:Currently I try to make the vmx22 downwash effect working over MP. Getting the door movements visible over mp works nice by reading the property tree for the door and writing it to “sim/multiplay/generic/float[x]” in the update loop for the use over mp.

my problem:
The downwash effects use the “position/gear-agl-m”, but if I try to get this value from the property tree with

Code: Select all
var gear_magl = props.globals.getNode("position/gear-agl-m", 1);

I get no value. Accessing this value in the v22.xml works. Why do get no value if I try to access this property with nasal?

Where do I find a list of the properties that are supported by the mp-protocol? I had a look in the mp documentation, but I could not find anything.


The full list of MP enabled properties are in multiplaymgr.cxx.

IMO a good way to map local properties to generic MP properties is to use aliases, e.g. from ZLT-NT-set.xml:
Code: Select all
Aircraft/ZLT-NT/ZLT-NT-set.xml:
 <sim>
  ...
  <multiplay>
   <generic>
    <float n="0" alias="/fdm/jsbsim/propulsion/engine[0]/pitch-angle-rad"/>
    <float n="1" alias="/fdm/jsbsim/propulsion/engine[1]/pitch-angle-rad"/>
    <float n="2" alias="/fdm/jsbsim/propulsion/engine[2]/pitch-angle-rad"/>
    <float n="3"
           alias="/instrumentation/heading-indicator/indicated-heading-deg"/>
    <float n="4"
           alias="/instrumentation/attitude-indicator/indicated-pitch-deg"/>
    <float n="5"
           alias="/instrumentation/attitude-indicator/indicated-roll-deg"/>
    ...
   </generic>
  </multiplay>
  ...
 </sim>


To further the readability of the animations one could also set up the corresponding aliases on the remote side so that the animations can use the logical property (here fdm/jsbsim/propulsion/engine[0]/pitch-angle-rad etc..):
Code: Select all
Aircraft/ZLT-NT/Models/ZLT-NT.xml:
 <nasal>
  <load>
var rplayer = cmdarg();
print("LOAD ZLT-NT", rplayer.getPath());

# Set up property aliases for animations.
rplayer.getNode("fdm/jsbsim/propulsion/engine[0]/pitch-angle-rad", 1).
  alias(rplayer.getNode("sim/multiplay/generic/float[0]"));
rplayer.getNode("fdm/jsbsim/propulsion/engine[1]/pitch-angle-rad", 1).
  alias(rplayer.getNode("sim/multiplay/generic/float[1]"));
rplayer.getNode("fdm/jsbsim/propulsion/engine[2]/pitch-angle-rad", 1).
  alias(rplayer.getNode("sim/multiplay/generic/float[2]"));
...
  </load>
 ...
 </nasal>

Note that the aliases are set up inside the subtree of property tree that belongs to this MP entry.

I don't know why your property misbehaves when read from Nasal - if you can see the value in the property browser, Nasal should see it too. Have you double checked the property name and path?

Cheers,

Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2525
Joined: Wed Nov 29, 2006 10:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: Property tree questions - position/gear-agl-m ?

Postby ot-666 » Sun Jul 04, 2010 3:24 pm

HHS wrote:A lot of properties aren't supported. But you can use “sim/multiplay/generic/float[x]” as well for that I guess.



I thought the same, but if I try to do it the same way that perfectly works for the doors I end up with a Nasal runtime error.

setprop() value is not a string or number :cry:

Any ideas? This happens if I try to read: position/…

Oliver
Callsign: ot-666
Working on LOWI and other stuff - Custom Scenery Overlay Repo: http://gitorious.org/fgfs-custom-scenery/custom-scenery-overlay/
VMX22 - Osprey... sometimes in 2014
ot-666
 
Posts: 746
Joined: Sun Nov 08, 2009 6:14 pm
Location: Germany, Konstanz
Callsign: ot-666
IRC name: ot666
Version: GIT
OS: win7 64bit

Re: Property tree questions - position/gear-agl-m ?

Postby AndersG » Sun Jul 04, 2010 3:27 pm

ot-666 wrote:
HHS wrote:A lot of properties aren't supported. But you can use “sim/multiplay/generic/float[x]” as well for that I guess.



I thought the same, but if I try to do it the same way that perfectly works for the doors I end up with a Nasal runtime error.

setprop() value is not a string or number :cry:

Any ideas? This happens if I try to read: position/…


A common cause of that is that you read from a non-existing property which makes getprop() return nil.
Double check the property name and path. Can you see the property in the property browser?

/Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2525
Joined: Wed Nov 29, 2006 10:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: Property tree questions - position/gear-agl-m ?

Postby ot-666 » Sun Jul 04, 2010 3:56 pm

AndersG wrote:
A common cause of that is that you read from a non-existing property which makes getprop() return nil.
Double check the property name and path. Can you see the property in the property browser?

/Anders


Hi Anders

Thanks for the full list of MP enabled properties. That is really helpful.

Yes… I can see the property in the property tree browser.

Edit:
If I read the property tree: position/ground-elev-m I get a value and no error. :?
The error only happens reading position/gear-agl-m or position/gear-agl-ft

Image

Oliver
Callsign: ot-666
Working on LOWI and other stuff - Custom Scenery Overlay Repo: http://gitorious.org/fgfs-custom-scenery/custom-scenery-overlay/
VMX22 - Osprey... sometimes in 2014
ot-666
 
Posts: 746
Joined: Sun Nov 08, 2009 6:14 pm
Location: Germany, Konstanz
Callsign: ot-666
IRC name: ot666
Version: GIT
OS: win7 64bit


Return to Nasal

Who is online

Users browsing this forum: No registered users and 3 guests