Property tree: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (PropertyTree template)
(Major revamp for Property Tree articles)
Line 1: Line 1:
{{Stub}}
{{PropertyTree}}The '''Property Tree''' is [[FlightGear]]'s central nervous system.
{{PropertyTree}}
A simple technical introduction about the FlightGear property tree can be found at [[Property Tree Intro]].


== Property Server ==
To make it easier, start FlightGear with the following command line
fgfs --httpd=5480
Then after a few moments open in a new window - [http://localhost:5480 http://localhost:5480]


For instance, start FlightGear with the following option:
==Introduction==
When a simulation is running, all the variables such as position, speed, flaps, cabin lights, et all are calculated and manipulated through a property tree.


--httpd=5400
The "virtual" tree that runs the simulation appears much like a directory/file structure. eg:
<pre>
/sim/aircraft = A333


You can pick any port number, but 5400 will probably work just fine.
/position/
/position/longitude-deg = '-122.3576677' (double)
/position/latitude-deg = '37.61372424' (double)
/position/altitude-ft = '28.24418581' (double)
/position/altitude-agl-ft = '22.47049626' (double)


/controls/seat/eject/initiate
/controls/electric/APU-generator
</pre>
Some of these variables are "calculated" within the sim, whilst others can be manipulated. Writing a variable is as easy as
/* Its my turn to play the sim */
set('/controls/seat/eject/initiate', 1)


Now on the same machine, fire up a web browser and open up the following url:
The values can also be set from the httpd interface.


http://localhost:5400/
What makes FG powerful is that a new aircraft can easily be designed with its unique set of properties that somehow affect the simulation. The Aircraft model has an xml file of properties within the property tree.


Now you can browse the entire FG property tree "live" and even change values if you like. You can configure autopilot modes and even set control inputs so you can literally fly the airplane from your web browser, although it's not the most convenient interface for doing that. ;-)
This is why the property tree is not consitent with fixed variables, they are created dynamically, to represent a propeller plane vs Jumbo or even a "Caspian Sea Monster".


There is a similar interface minus the html wrappings that you can enable with the following option:
The property tree is read, written, accessed and manipulated in a variety of ways, such as
* internal compiled code within FG - the c/c++ code
* [[Nasal]] scripts - this is javascript like scripting with read/write to the property tree. This is the way most aircraft are implemented.
* sockets that are either in/out/bi - this allows send/recieve to the FG sim via sockets
* telnet interface - query and fly the plane on the command line
* html interface - fly the plane with a browser or an PDA
What makes multiplayer work for example is a set of variables from the tree are broadcasted across the network as Bytes eg height, pos, etc


--props=5401
For a motion simulator one would be interested in
<pre>
Brandon to do this about gforce
</pre>


 
==Flight Dynamics Model (FDM)==
Note that you can setup as many of these as you want ... for instance, just to be obscene you could do:
FlightGear uses a few [[Flight Dynamics Models]], such as
 
* [[JSBSim]]  
--httpd=5400
* [[YASim]]  
--httpd=5401
These flight dynamics model present themselves differently in the tree, different variables in diferent places. That is what an aircraft can be designed around.
--httpd=5402
--props=5403
--props=5404
--props=5405
 
 
Now you have 6 different network interfaces running that you can access from anywhere. We can't find a wiki named Note.
 
If you have a 'props' inteface configured you can now "telnet localhost 5401" and interact with the property system (again live) and set and examine values using a 'command line' style interface.
 
The cool thing is that you can easily write scripts to access this --props=<port#> interface.
 
Take a look at:
 
FlightGear/source/scripts/perl/examples/
 
 
Note that there is no requirement that you do this with perl. You could just as easily interact with FlightGear this way using perl, C, C++, java, probably even <ack> visual basic or anything else that can do tcpip network communication ... matlab? netcat?
 
Also note that the downside to this interface is that you can't blast a lot of data across it. It's fine if you want to monitor location and speed every second or 1/4 second and occasionally set some values (such as dump in a new weather configuration, reset the aircraft location, or read a set of values, etc.)
 
But if you need to track 100 different variables at 60hz, this isn't the interface for you.
 
 
 
 
== Property Tree ==
A detailed list of all nodes within the property tree and their purpose, as well as possible values
 
==== accelerations/ ====
==== ai/ ====
==== autopilot/ ====
==== command/ ====
==== consumables/ ====
 
* fuel/
** tank/
** tank[1]/
** tank[2]/
** tank[3]/
** total-fuel-gals
** total-fuel-lbs
** total-fuel-norm
 
Note: The number of tanks will vary between aircraft. Please take this into account when you are designing your script
 
==== controls/ ====
 
* APU
** fire-switch
** off-start-run
 
==== devices/ ====
==== engines/ ====
==== environment/ ====
==== fdm/ ====
==== gear/ ====
==== input/ ====
==== instrumentation/ ====
==== logging/ ====
==== models/ ====
==== nasal/ ====
==== orientation/ ====
The set of properties in orientation/ detail the orientation of the aircraft (pitch, yaw and roll).
 
* alpha-deg
* heading-deg
* heading-magnetic-deg
* pitch-deg
* pitch-rate-degps
* roll-deg
* roll-rate-degps
* side-slip-deg
* side-slip-rad
* yaw-deg
* yaw-rate-degps
 
==== position/ ====
The set of properties in position/ track the lat/lon location of the user's aircraft, as well as altitude and ground elevation immediately below the aircraft.
 
* longitude-deg -- Current longitude of the aircraft in degrees.
* latitude-deg -- Current latitude of the aircraft in degrees.
* altitude-ft -- Current altitude of the aircraft above mean sea level.
* ground-elev-m -- elevation of the ground below the aircraft, in meters.  Note that for this property,  ground structures are considered part of the ground.  Thus, flying over any ground structure (a building, a sign, a radio tower, whatever) will raise the value of this property for as long as the aircraft is over the structure.
* altitude-agl-ft -- Current altitude of the aircraft above ground/ground structures below.
 
==== sim/ ====
* aero --
* ai
* ai-traffic
* aircraft --
* aircraft-dir --
* aircraft-min-status --
* alarms --
* allow-toggle-cockpit --
* ATC
* atc
* author --
* auto-coordination -- boolean (true/false) flag indicating whether auto-coordination is on or off.
* chase-distance-m --
* control-mode --
* current-view
* description --
* flight-model --
* frame-rate --
* freeze
* hud
* input
* instrumentation
* instrument-options
* intl
* logging
* model-hz --
* multiplay
* panel
* presets
* rendering
* sound
* speed-up --
* startup/
** fullscreen
** game-mode
** intro-music
** options/
*** airport
*** heading-deg
*** latitude-deg
*** longitude-deg
*** runway
** path-cache/
** save-on-exit
** season
** splash-alpha
** splash-progress
** splash-progress-text
** splash-screen
** splash-texture
** splash-title
** stderr-to-terminal
** stdout-to-terminal
** terminal-ansi-colors
** time-offset
** time-offset-type
** units
** xsize
** ysize
* status --
* time
* view-mode --
* menubar/
* model/
* mouse/
* navdb/
* number-views =  '6'    (int)
* replay/
* sceneryloaded = 'true'  (bool)
* submodels/
* systems/
* temp/
* tower/
* traffic-manager/
* user/
* view/
* view[1]/
* view[2]/
* view[3]/
* view[4]/
* view[5]/
* virtual-cockpit =      'false' (bool)
 
==== surface-positions/ ====
==== systems/ ====
==== velocities/ ====
<nowiki>   
</nowiki>
[http://www.beispiel.de Link-Text]
[[Media:Beispiel.mp3]]
[[Image:Beispiel.jpg]]
fgfs --aircraft=(beispiel-737)
 
[[Category:List]]

Revision as of 16:53, 9 September 2009

The Property Tree is FlightGear's central nervous system.

To make it easier, start FlightGear with the following command line

fgfs --httpd=5480

Then after a few moments open in a new window - http://localhost:5480

Introduction

When a simulation is running, all the variables such as position, speed, flaps, cabin lights, et all are calculated and manipulated through a property tree.

The "virtual" tree that runs the simulation appears much like a directory/file structure. eg:

/sim/aircraft = A333

/position/
/position/longitude-deg =	'-122.3576677'	(double)
/position/latitude-deg =	'37.61372424'	(double)
/position/altitude-ft =	'28.24418581'	(double)
/position/altitude-agl-ft =	'22.47049626'	(double)

/controls/seat/eject/initiate
/controls/electric/APU-generator

Some of these variables are "calculated" within the sim, whilst others can be manipulated. Writing a variable is as easy as

/* Its my turn to play the sim */
set('/controls/seat/eject/initiate', 1)

The values can also be set from the httpd interface.

What makes FG powerful is that a new aircraft can easily be designed with its unique set of properties that somehow affect the simulation. The Aircraft model has an xml file of properties within the property tree.

This is why the property tree is not consitent with fixed variables, they are created dynamically, to represent a propeller plane vs Jumbo or even a "Caspian Sea Monster".

The property tree is read, written, accessed and manipulated in a variety of ways, such as

  • internal compiled code within FG - the c/c++ code
  • Nasal scripts - this is javascript like scripting with read/write to the property tree. This is the way most aircraft are implemented.
  • sockets that are either in/out/bi - this allows send/recieve to the FG sim via sockets
  • telnet interface - query and fly the plane on the command line
  • html interface - fly the plane with a browser or an PDA

What makes multiplayer work for example is a set of variables from the tree are broadcasted across the network as Bytes eg height, pos, etc

For a motion simulator one would be interested in

Brandon to do this about gforce

Flight Dynamics Model (FDM)

FlightGear uses a few Flight Dynamics Models, such as

These flight dynamics model present themselves differently in the tree, different variables in diferent places. That is what an aircraft can be designed around.