Telnet usage: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
Line 114: Line 114:
run a built in command, you need to give the command name.
run a built in command, you need to give the command name.


* set <var> <val>   set <var> to a new <val>
==set==
Sets the value of a given parameter, for example, to set the aileron position inside the /controls/flight  directory:
<pre>
/> cd controls/flight
/controls[0]/flight[0]> set aileron 0.2
aileron = '0.2' (double)
/controls[0]/flight[0]>
</pre>
or simply:
<pre>
/> set /controls/flight/aileron -0.1
/controls/flight/aileron = '-0.1' (double)
/>  
</pre>

Revision as of 07:12, 16 April 2009

Flightgear comes with a internal telnet server that can be used to read end set values within the [Property_Tree|property tree] structure. The telnet feature can be activated through the --telnet=port option, where port is the number of the listening port that will be opened.
A connection to the server can be done using a telnet client or opening a simple socket from any program, multiple connection are possible at the same time.

Starting Flightgear with telnet

For example, if you wish to start FG and open the port 10000 as available telnet server use this command:

fgfs --telnet=10000

Usage with a telnet client

Once connected to the server using a telnet client, you will be given a prompt such as if you where connected to a unix telnet server, example:

francesco@francesco-desktop:~$ telnet 127.0.0.1 10000
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.

Where 127.0.0.1 is the ip address of the runnung fg server and 10000 is the port used when fg has been started.
Now that you are inside the telnet session, you can start giving commands (see below) to fg. Generally commands are used to get, change and navigate values of the property tree in way similar when you are working with directories and files.

Prompt

Since we are simulating a navigation through a file system, you will be given a prompt, the prompt consists in 2 parts:

  1. current tree position
  2. (the characters >(space))

so you will typically see something like: /> and when changing to an other folder you could see: /folder[0]>

Commands

A list of command is available to you to be entered in any telnet connection, if you don't remember the commands, just write ? and press enter to get the following list:

cd

Used to change currend working directory, it needs a parameter witch is the destination directory. example:

/> cd controls
/controls[0]> 

To go to upper level use the .. directory name. example:

/controls[0]> cd ..
/> 

data

switch to data mode, (It removes the prompt)

dump

dump the current state (in xml)

get

Shows the value of a given parameter, for example, to get the magnetos status inside the controls/engines/engine directory:

/> cd controls/engines/engine
/controls[0]/engines[0]/engine[0]>  get magnetos
magnetos = '3' (int)
/controls[0]/engines[0]/engine[0]> 

or simply:

/> get controls/engines/engine/magnetos
controls/engines/engine/magnetos = '3' (int)
/> 

help

show all the available commands

ls

list all the directories and parametes under the currend directory, for example:

 /> cd orientation
/orientation[0]> ls
heading-deg =	'70.62909768'	(double)
roll-deg =	'-0.1304105574'	(double)
pitch-deg =	'3.454917663'	(double)
heading-magnetic-deg =	'69.33324708'	(double)
side-slip-deg =	'-1.649715344'	(double)
roll-rate-degps =	'0.005311019842'	(double)
yaw-rate-degps =	'0.9291174864'	(double)
side-slip-rad =	'-0.02879296447'	(double)
yaw-deg =	''	(none)
alpha-deg =	'-176.8560635'	(double)
pitch-rate-degps =	'3.347789774e-07'	(double)
/orientation[0]> 

or simply:

 /> ls /orientation
heading-deg =	'104.6032849'	(double)
roll-deg =	'0.05700780397'	(double)
pitch-deg =	'3.383815996'	(double)
heading-magnetic-deg =	'103.3074408'	(double)
side-slip-deg =	'-0.8108666857'	(double)
roll-rate-degps =	'0.004904539782'	(double)
yaw-rate-degps =	'0.9516625654'	(double)
side-slip-rad =	'-0.01415229346'	(double)
yaw-deg =	''	(none)
alpha-deg =	'-176.864208'	(double)
pitch-rate-degps =	'-0.003761442232'	(double)
/> 

prompt

switch to interactive mode (default)

pwd

display your current path

quit

Terminate the connection

run

run a built in command, you need to give the command name.

set

Sets the value of a given parameter, for example, to set the aileron position inside the /controls/flight directory:

/> cd controls/flight
/controls[0]/flight[0]> set aileron 0.2
aileron = '0.2' (double)
/controls[0]/flight[0]> 

or simply:

/> set /controls/flight/aileron -0.1
/controls/flight/aileron = '-0.1' (double)
/>