Property Tree Servers

From FlightGear wiki
Revision as of 07:35, 7 September 2009 by Ac001 (talk | contribs) (Property Servers)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Web Server

To view the Property Tree with a web browser, start FlightGear with the following option:

--httpd=5400

where 5400 is the port number. You can pick any port number, but 5400 will probably work just fine.

Now on the same machine, fire up a web browser and open up the following url:

http://localhost:5400/

Now you can browse the entire FG property tree "live" (you'll need to refresh the browser) 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. ;-)

Props Server

There is a similar interface minus the html wrappings that you can enable with the following option:

fgfs --props=5401

Once you have a 'props' interface 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. This is covered more on the Telnet page.

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, python, 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.

Multi Servers

Note that you can setup as many of these as you want ... for instance, just to be obscene you could do:

fgfs --httpd=5400 --httpd=5401 --httpd=5402 --props=5403 --props=5404 --props=5405

Now there are 6 different network interfaces running that you can access from anywhere.