Property Tree/Web Server: Difference between revisions
mNo edit summary |
No edit summary |
||
Line 19: | Line 19: | ||
* Serving the uri /run.cgi as a replacement for the old interface to run fg_commands | * Serving the uri /run.cgi as a replacement for the old interface to run fg_commands | ||
* Serving the uri /json/ to return selected properties as JSON (read-only so far) | * Serving the uri /json/ to return selected properties as JSON (read-only so far) | ||
{{FGCquote | |||
|If your using fgrun, under Advanced (last tab)/ Network, check httpd and enter 5500. Then in a compatible browser use <code>http://localhost:5500/gui/</code> | |||
|{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=237925#p237925 | |||
|title=<nowiki>Re: Heaven or Hell? Phi sneak preview.</nowiki> | |||
|author=<nowiki>wlbragg</nowiki> | |||
|date=<nowiki>Sun Apr 05</nowiki> | |||
}} | |||
}} | |||
}} | }} | ||
Revision as of 18:14, 5 April 2015
Note This feature received significant updates in FlightGear 3.1+:
While working on the new radio/atis implementation, Torsten rediscovered the internal httpd (aka webserver) to browse the property tree. It's much easier to have multiple browser windows open and point to various locations in the property tree than to reopen the internal property browser and navigate to the locations after each sim restart. After a while, Torsten got disappointed by the functionality and the look&feel of the http property-browser, so he had a look at the code to see if it could be improved, he quickly realized, that the implementation was simple but not scalable, so he looked for something allready available on the GPL market. And he found Mongoose as a well maintained, feature rich and yet simple implementation of a web server and started to embedd that into FlightGear. What is ready so far and pushed to next is:
|
FlightGear has a few network access protocols. These are started via a command line option.
And, just for fun we have an embedded web server you can activate which exposes the internal property tree via a web style interface that you can browse (and edit) with any web browser. You can literally fly the airplane remotely via your web browser. It's primarily there as an interactive remote debugging tool, but it could be used for many things.
Web Server
To view the PropertyTree with a web browser, start FlightGear with the following option:
fgfs --httpd=5480
where 5480 is the port number. You can pick any port number, but 5480 will probably work just fine.
On the same machine, fire up a web browser and open up the following url:
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. ;-)
Note that you can setup as many of these as you want ... for instance, just to be obscene you could do:
- --httpd=5400
- --httpd=5401
- --httpd=5402
- --props=5403
- --props=5404
- --props=5405
Now you have 6 different network interfaces running that you can access from anywhere. [Note: security issues if not used wisely.]