Property Tree/Web Server: Difference between revisions

Jump to navigation Jump to search
no edit summary
(oops)
No edit summary
Line 15: Line 15:
[http://localhost:5480/ http://localhost:5480/]
[http://localhost:5480/ http://localhost:5480/]


You can now browse the entire FG property tree "live" as the sim is running. You need to refresh the browser so see changes and you can even change values if you like. You could configure autopilot modes and even set control inputs so you can literally fly the airplane from your web browser, although it's maybe not the most convenient interface for doing that. ;-)
You can now browse the entire FG property tree "live" as the sim is running. You need to refresh the browser to see changes and you can even change values if you like. You can configure autopilot modes and even set control inputs so you could literally fly the airplane from your web browser, although it's maybe not the most convenient interface for doing that. ;-)


==Telnet Server==
==Telnet Server==
Line 22: Line 22:
A connection to the server can be done using a [[Telnet usage|telnet client]] or opening a simple socket from any program. Multiple connections (more below) are possible at the same time. Too start FG and open the port 5401 as available telnet server use this command:
A connection to the server can be done using a [[Telnet usage|telnet client]] or opening a simple socket from any program. Multiple connections (more below) are possible at the same time. Too start FG and open the port 5401 as available telnet server use this command:
  fgfs --telnet=5401
  fgfs --telnet=5401
Using this server is covered in detail on the [[Telnet usage]] page.
Using this server protocol is covered in detail on the [[Telnet usage]] page.


==Manipulate Properties==
==Manipulate Properties==
Line 32: Line 32:
   conn.set("/gear/state", "up")
   conn.set("/gear/state", "up")


Some links to source code example in various flavours:
Some links to source code examples in various flavours:
* Perl - [http://cvs.flightgear.org/viewvc/source/scripts/perl/examples/ /source/scripts/perl/examples].
* Perl - [http://cvs.flightgear.org/viewvc/source/scripts/perl/examples/ /source/scripts/perl/examples].
* Python - [http://cvs.flightgear.org/viewvc/source/scripts/python/ /source/scripts/python/]
* Python - [http://cvs.flightgear.org/viewvc/source/scripts/python/ /source/scripts/python/]
* Java - [http://cvs.flightgear.org/viewvc/source/scripts/java/ source/scripts/java/]
* Java - [http://cvs.flightgear.org/viewvc/source/scripts/java/ source/scripts/java/]


You could just as easily interact with a running FlightGear instance using perl, C, C++, java, python, probably even <ack> visual basic or anything else that can do tcpip network communication ... matlab? netcat? twisted?
You could just as easily interact with a running FlightGear instance using perl, C, C++, java, python, probably even <ack> visual basic or anything else that can do TCP/IP network communication ... matlab? netcat? twisted?


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.)
Also note that the downside to the telnet 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. For that you need a [[PropertyTree:Socket]].
If you need to track 100 different variables at 60hz, this isn't the interface for you.
For that you need a '''[[PropertyTree:Sockets|socket]]'''.


==Multi Servers==
==Multi Servers==
Note that you can setup as many of these servers as you want, for instance, just to be obscene you could do:
Note that you can setup as many of these servers 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
  fgfs --httpd=5400 --httpd=5401 --httpd=5402 --telnet=5403 --telnet=5404 --telnet=5405


Now there are six network interfaces running that you can access from anywhere ;-) >> can I borrow your ipod please. why ?
Now there are six network interfaces running that you can access from anywhere ;-) >> can I borrow your ipod please. why ?
399

edits

Navigation menu