Nasal Modules

From FlightGear wiki
Jump to navigation Jump to search
This article is a stub. You can help the wiki by expanding it.

This page is meant to help document the purpose and function of the standard Nasal modules provided in the FlightGear base package ($FG_ROOT/Nasal). Ideally, all modules will be introduced along with a description, provided methods and example source code.

Tip  see Nasal Initialization for information on different module types and how Nasal and its modules are initialized.

aircraft.nas

This module provide basic functions and classes for use in aircraft specific Nasal context.

history()

history();

Get flight history. This function returns a ghost object related to FGFlightHistory class.

Example

var history = aircraft.history();

pathForHistory()

pathForHistory(minEdgeLengthM);

Get path for flight history. This function returns a vector of hashes as path points. Each hash contains the following keys: lat, lon, elevation (the altitude of the aircraft in meters).

minEdgeLengthM
Minimum length of segment in meters. Shorter segments will be collapsed. Default is 50.0, type double.

Example

var history = aircraft.history();
var path = history.pathForHistory(1000);
foreach (var point; path) {
    logprint(LOG_ALERT, "lat = ", point.lat, " lon = ", point.lon, " elevation = ", point.elevation);
}

atc-chatter.nas

Simple sequenced ATC background chatter function

bits.nas

bit level manipulation routines

controls.nas

controls related functions

debug.nas

see Nasal library/debug

dynamic_view.nas

Dynamic Cockpit View manager. Tries to simulate the pilot's most likely deliberate view direction. Doesn't consider forced view changes due to acceleration.

fuel.nas

Manages consumables

geo.nas

geo functions

modules.nas

Modules.nas - support for runtime re-loadable Nasal modules

props.nas

Props.nas - functions to work with FlightGear's Property tree

also see: http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg10326.html and: http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg18962.html