| 1 | <html> |
| 2 | <head> |
| 3 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
| 4 | <title>FlightGear: Remote control</title> |
| 5 | <meta name="Author" content="Melchior FRANZ"> |
| 6 | <meta name="KeyWords" content="flightgear,fgfs,flightsimulator,simulator,remote,control,perl,c,c++"> |
| 7 | <link rel="StyleSheet" type="text/css" href="fgfs.css"> |
| 8 | <link rel="SHORTCUT ICON" href="mf.ico"> |
| 9 | |
| 10 | </head> |
| 11 | |
| 12 | <body> |
| 13 | <h1>FlightGear: Remote control</h1> |
| 14 | |
| 15 | |
| 16 | <p>FlightGear has several interfaces that provide access to internal |
| 17 | parameters. The HTTP interface is best suited for human interaction |
| 18 | via a web browser. The telnet interface is the ideal choice for |
| 19 | remotely controlling FlightGear by means of external programs. |
| 20 | </p> |
| 21 | |
| 22 | <p>To activate FlightGear's telnet server capabilities, call it with |
| 23 | a <em>--telnet</em> specifiaction: |
| 24 | |
| 25 | <blockquote> |
| 26 | <pre> |
| 27 | $ fgfs --telnet=socket,bi,5,localhost,5501,tcp |
| 28 | </pre> |
| 29 | |
| 30 | <br> |
| 31 | <br> |
| 32 | <table> |
| 33 | <tr><td><strong>socket:</strong></td><td>FlightGear protocol</td></tr> |
| 34 | <tr><td><strong>bi:</strong></td><td>bidirectional</td></tr> |
| 35 | <tr><td><strong>5:</strong></td><td>polling frequency in Hertz</td></tr> |
| 36 | <tr><td><strong>localhost: </strong></td><td>server name or IP-address</td></tr> |
| 37 | <tr><td><strong>5501: </strong></td><td>server port</td></tr> |
| 38 | <tr><td><strong>tcp:</strong></td><td>internet protocol type</td></tr> |
| 39 | </table> |
| 40 | </blockquote> |
| 41 | |
| 42 | <br> |
| 43 | <br> |
| 44 | In newer versions of FlightGear just type: |
| 45 | <blockquote> |
| 46 | <pre> |
| 47 | $ fgfs --telnet=5501 |
| 48 | </pre> |
| 49 | </blockquote> |
| 50 | </p> |
| 51 | |
| 52 | <p>To learn more about the supported commands, connect to FlightGear |
| 53 | with a telnet program and type in "help<RETURN>". This is what you'll get:<p> |
| 54 | |
| 55 | <blockquote> |
| 56 | <pre> |
| 57 | $ telnet localhost 5501 |
| 58 | Trying ::1... |
| 59 | Trying 127.0.0.1... |
| 60 | Connected to localhost. |
| 61 | Escape character is '^]'. |
| 62 | help |
| 63 | |
| 64 | Valid commands are: |
| 65 | |
| 66 | help show help message |
| 67 | ls [<dir>] list directory |
| 68 | dump dump current state (in xml) |
| 69 | cd <dir> cd to a directory, '..' to move back |
| 70 | pwd display your current path |
| 71 | get <var> show the value of a parameter |
| 72 | show <var> synonym for get |
| 73 | set <var> <val> set <var> to a new <val> |
| 74 | data switch to raw data mode |
| 75 | prompt switch to interactive mode (default) |
| 76 | quit terminate connection |
| 77 | |
| 78 | /> |
| 79 | </pre> |
| 80 | </blockquote> |
| 81 | |
| 82 | <p>Now you can browse in the property system like in a Linux file |
| 83 | system with <em>cd, ls, pwd</em>.</p> |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | <p>Here you can <a href="fgfsscript">download a sample script</a> |
| 89 | written in Perl, that shows how to access and manipulate FlightGear's |
| 90 | internal parameters. It can be started before FlightGear (in which |
| 91 | case it tries up to 2 minutes to connect) or afterwards. Then |
| 92 | it picks a random AGL altitude and checks every 5 seconds |
| 93 | if the aircraft has already climbed at this height. Now it starts |
| 94 | to empty all four tanks, one after the other, until the engines |
| 95 | stop working. Try to find a place where you can land safely. :-)</p> |
| 96 | |
| 97 | <blockquote> |
| 98 | <pre> |
| 99 | $ fgfsscript& |
| 100 | $ fgfs --telnet=socket,bi,5,localhost,5501,tcp |
| 101 | </pre> |
| 102 | </blockquote> |
| 103 | |
| 104 | <p>The script defaults to <em>localhost</em> and <em>port 5501</em>, |
| 105 | but you can let the script control FlightGear on another host and |
| 106 | under another port.</p> |
| 107 | |
| 108 | <blockquote> |
| 109 | <pre> |
| 110 | $ fgfsscript some.host.org 1234& |
| 111 | </pre> |
| 112 | </blockquote> |
| 113 | |
| 114 | |
| 115 | <p>Demo programs are available in:<br> |
| 116 | <ul> |
| 117 | <li><a href="fgfsclient.c">C</a></li> |
| 118 | <li><a href="fgfsclient.cxx">C++</a></li> |
| 119 | <li><a href="fgfsscript">Perl (same as mentioned above)</a></li> |
| 120 | </ul> |
| 121 | </p> |
| 122 | |
| 123 | </body> |
| 124 | </html> |