Remote Control

FCMDRIVER remote control protocol

Remote control protocol

The standalone model driver may be controlled from a remote host over TCP/IP. The driver listens for connections on TCP port 25200, and accepts commands using a simple text-based protocol.

Commands are plaintext strings, terminated by a newline (ASCII LF (0x0A), '\n' in C).

Command responses

After the command has completed, the driver will respond with a line containing a single period (".\n"). If there was an error, it will respond with a question mark ("?\n").

Lines beginning with a '-' contain error messages in response to the currently executing command. Lines beginning with a '+' contain a normal (non-error) response.

Lines beginning with an exclamation point ("!...") indicate an asynchronous message from the driver to the controlling host. The driver may produce asynchronous notifications at any time. Notifications include:

!ok
Indicates that the connection has been established.
!running
Indicates that the simulation is running.
!paused
Indicates that the simulation is paused.
!standby
Indicates that the simulation is in standby mode (trimming, playback, or other long-running process).
!crashed
Indicates that the driver has encountered an error.
!reset
Sent when the simulation is reset
!done
Sent when the simulation is shutting down

Other asynchronous notifications may also be sent, described elsewhere.

Datagram sockets

Commands may also be sent on UDP port 25200. The driver does not send a response to commands received over UDP, so commands like model.get are not useful in this mode, but for cases where the host does not need a reply using UDP is often simpler.

Tips

You can communicate with the driver directly with the Unix shell command:

telnet localhost 25200

Or from a different machine, substitute 'localhost' with the name of the host on which the driver is running.

Available commands

The following commands are available:

run
Start running
pause
Pause the simulation
runtoggle
Toggle between 'running' and 'paused' states.
reset
Reset the simulation (e.g., after a crash) to the last checkpoint.
The simulation is left in the 'paused' state afterwards.
shutdown
Stop the simulation and terminate the driver.
model.set varname value
Sets the value of a Scope model variable. varname must be the full path to the variable (not including the WORLD group), and all upper-case.
model.get varname
Returns the value of a Scope model variable.
model.lsfields
Returns a list of all Scope model variables in the current model, one per line (internal use).
model.update
Update all model outputs (internal use)
model.step
Single-step the model
model.reload
Reloads the model in its initial configuration.
model.save filename
Saves the current state of the model to the named checkpoint file. If the filename is omitted, a default checkpoint file is used. Subsequent 'reset' operations will restore this state.
model.restore filename
Restores the named checkpoint. If the filename is omitted, the most recently saved checkpoint is restored.
model.trim
Initiate the trim process. See for details.

Trimming the model

The model.trim remote control command initiates the trim process. This will try to find a set of control positions which will hold the aircraft at a given flight path.

By default, the aircraft is trimmed to level flight at the current airspeed. Additional arguments to model.trim may be supplied as follows:

model.trim speed climbrate turnrate
speed
Specifies the in-plane inertial velocity in feet/sec. If omitted, defaults to the current inertial velocity
climbrate
Specifies the climb rate (if positive) or descent rate (if negative) in feet per second. Defaults to 0.
turnrate
Specifies the turn rate in radians per second. Defaults to 0.

The trim process may take up to 10 seconds. The status of the trim is reported via the following asynchronous notifications:

!trim started
Sent when the trim process starts
!trim finished
Sent when the trim process completes successfully
!trim failed
Sent if the trim process fails