Flight Management Computer
Note: the FMS works based on an array of entries. Indices into the array are zero-based. Each entry is a navaid plus an altitude. The FMS tracks the currently displayed entry and the entry that it is flying to.
The FMS must be programmed with contiguous entries, so clearing an entry at the end shortens the effective flight plan. There is a max of 100 waypoints in the flight plan.
XPLMCountFMSEntries
function
This routine returns the number of entries in the FMS.
-- returns int -> assign to local/var
local my_result = XPLMCountFMSEntries(
)
XPLMGetDisplayedFMSEntry
function
This routine returns the index of the entry the pilot is viewing.
-- returns int -> assign to local/var
local my_result = XPLMGetDisplayedFMSEntry(
)
XPLMGetDestinationFMSEntry
function
This routine returns the index of the entry the FMS is flying to.
-- returns int -> assign to local/var
local my_result = XPLMGetDestinationFMSEntry(
)
XPLMSetDisplayedFMSEntry
function
This routine changes which entry the FMS is showing to the index specified.
XPLMSetDisplayedFMSEntry(
inIndex -- int
)
XPLMSetDestinationFMSEntry
function
This routine changes which entry the FMS is flying the aircraft toward. The track is from the n-1'th point to the n'th point.
XPLMSetDestinationFMSEntry(
inIndex -- int
)
XPLMGetFMSEntryInfo
function
This routine returns information about a given FMS entry. If the entry is an airport or navaid, a reference to a nav entry can be returned allowing you to find additional information (such as a frequency, ILS heading, name, etc.). Note that this reference can be XPLM_NAV_NOT_FOUND until the information has been looked up asynchronously, so after flightplan changes, it might take up to a second for this field to become populated. The other information is available immediately. For a lat/lon entry, the lat/lon is returned by this routine but the navaid cannot be looked up (and the reference will be XPLM_NAV_NOT_FOUND). FMS name entry buffers should be at least 256 chars in length.
WARNING: Due to a bug in X-Plane prior to 11.31, the navaid reference will not be set to XPLM_NAV_NOT_FOUND while no data is available, and instead just remain the value of the variable that you passed the pointer to. Therefore, always initialize the variable to XPLM_NAV_NOT_FOUND before passing the pointer to this function.
XPLMGetFMSEntryInfo(
inIndex, -- int
outType, -- XPLMNavType
outID, -- char
outRef, -- XPLMNavRef
outAltitude, -- int
outLat, -- float
outLon -- float
)
See associated types:
XPLMSetFMSEntryInfo
function
This routine changes an entry in the FMS to have the destination navaid passed in and the altitude specified. Use this only for airports, fixes, and radio-beacon navaids. Currently of radio beacons, the FMS can only support VORs and NDBs. Use the routines below to clear or fly to a lat/lon.
XPLMSetFMSEntryInfo(
inIndex, -- int
inRef, -- XPLMNavRef
inAltitudeFt -- int
)
See associated types:
XPLMSetFMSEntryLatLon
function
This routine changes the entry in the FMS to a lat/lon entry with the given coordinates.
XPLMSetFMSEntryLatLon(
inIndex, -- int
inLat, -- float
inLon, -- float
inAltitudeFt -- int
)
XPLMClearFMSEntry
function
This routine clears the given entry, potentially shortening the flight plan.
XPLMClearFMSEntry(
inIndex -- int
)
XPLMNavFlightPlan
enum XPLM410
These enumerations defines the flightplan you are accesing using the FMSFlightPlan functions. An airplane can have up to two navigation devices (GPS or FMS) and each device can have two flightplans. A GPS has an enroute and an approach flightplan. An FMS has an active and a temporary flightplan. If you are trying to access a flightplan that doesn't exist in your aircraft, e.g. asking a GPS for a temp flightplan, FMSFlighPlan functions have no effect and will return no information.
| Name | Value | Description |
|---|---|---|
| xplm_Fpl_Pilot_Primary | 0 | |
| xplm_Fpl_CoPilot_Primary | 1 | |
| xplm_Fpl_Pilot_Approach | 2 | |
| xplm_Fpl_CoPilot_Approach | 3 | |
| xplm_Fpl_Pilot_Temporary | 4 | |
| xplm_Fpl_CoPilot_Temporary | 5 |
Used by:
- XPLMClearFMSFlightPlanEntry
- XPLMCountFMSFlightPlanEntries
- XPLMGetDestinationFMSFlightPlanEntry
- XPLMGetDisplayedFMSFlightPlanEntry
- XPLMGetFMSFlightPlanEntryInfo
- XPLMSetDestinationFMSFlightPlanEntry
- XPLMSetDirectToFMSFlightPlanEntry
- XPLMSetDisplayedFMSFlightPlanEntry
- XPLMSetFMSFlightPlanEntryInfo
- XPLMSetFMSFlightPlanEntryLatLon
- XPLMSetFMSFlightPlanEntryLatLonWithId
XPLMCountFMSFlightPlanEntries
function XPLM410
This routine returns the number of entries in the FMS.
-- returns int -> assign to local/var
local my_result = XPLMCountFMSFlightPlanEntries(
inFlightPlan -- XPLMNavFlightPlan
)
See associated types:
XPLMGetDisplayedFMSFlightPlanEntry
function XPLM410
This routine returns the index of the entry the pilot is viewing.
-- returns int -> assign to local/var
local my_result = XPLMGetDisplayedFMSFlightPlanEntry(
inFlightPlan -- XPLMNavFlightPlan
)
See associated types:
XPLMGetDestinationFMSFlightPlanEntry
function XPLM410
This routine returns the index of the entry the FMS is flying to.
-- returns int -> assign to local/var
local my_result = XPLMGetDestinationFMSFlightPlanEntry(
inFlightPlan -- XPLMNavFlightPlan
)
See associated types:
XPLMSetDisplayedFMSFlightPlanEntry
function XPLM410
This routine changes which entry the FMS is showing to the index specified.
XPLMSetDisplayedFMSFlightPlanEntry(
inFlightPlan, -- XPLMNavFlightPlan
inIndex -- int
)
See associated types:
XPLMSetDestinationFMSFlightPlanEntry
function XPLM410
This routine changes which entry the FMS is flying the aircraft toward. The track is from the n-1'th point to the n'th point.
XPLMSetDestinationFMSFlightPlanEntry(
inFlightPlan, -- XPLMNavFlightPlan
inIndex -- int
)
See associated types:
XPLMSetDirectToFMSFlightPlanEntry
function XPLM410
This routine changes which entry the FMS is flying the aircraft toward. The track is from the current position of the aircraft directly to the n'th point, ignoring the point before it.
XPLMSetDirectToFMSFlightPlanEntry(
inFlightPlan, -- XPLMNavFlightPlan
inIndex -- int
)
See associated types:
XPLMGetFMSFlightPlanEntryInfo
function XPLM410
This routine returns information about a given FMS entry. If the entry is an airport or navaid, a reference to a nav entry can be returned allowing you to find additional information (such as a frequency, ILS heading, name, etc.). Note that this reference can be XPLM_NAV_NOT_FOUND until the information has been looked up asynchronously, so after flightplan changes, it might take up to a second for this field to become populated. The other information is available immediately. For a lat/lon entry, the lat/lon is returned by this routine but the navaid cannot be looked up (and the reference will be XPLM_NAV_NOT_FOUND). FMS name entry buffers should be at least 256 chars in length.
WARNING: Due to a bug in X-Plane prior to 11.31, the navaid reference will not be set to XPLM_NAV_NOT_FOUND while no data is available, and instead just remain the value of the variable that you passed the pointer to. Therefore, always initialize the variable to XPLM_NAV_NOT_FOUND before passing the pointer to this function.
XPLMGetFMSFlightPlanEntryInfo(
inFlightPlan, -- XPLMNavFlightPlan
inIndex, -- int
outType, -- XPLMNavType
outID, -- char
outRef, -- XPLMNavRef
outAltitude, -- int
outLat, -- float
outLon -- float
)
See associated types:
XPLMSetFMSFlightPlanEntryInfo
function XPLM410
This routine changes an entry in the FMS to have the destination navaid passed in and the altitude specified. Use this only for airports, fixes, and radio-beacon navaids. Currently of radio beacons, the FMS can only support VORs, NDBs and TACANs. Use the routines below to clear or fly to a lat/lon.
XPLMSetFMSFlightPlanEntryInfo(
inFlightPlan, -- XPLMNavFlightPlan
inIndex, -- int
inRef, -- XPLMNavRef
inAltitudeFt -- int
)
See associated types:
XPLMSetFMSFlightPlanEntryLatLon
function XPLM410
This routine changes the entry in the FMS to a lat/lon entry with the given coordinates.
XPLMSetFMSFlightPlanEntryLatLon(
inFlightPlan, -- XPLMNavFlightPlan
inIndex, -- int
inLat, -- float
inLon, -- float
inAltitudeFt -- int
)
See associated types:
XPLMSetFMSFlightPlanEntryLatLonWithId
function XPLM410
This routine changes the entry in the FMS to a lat/lon entry with the given coordinates. You can specify the display ID of the waypoint.
XPLMSetFMSFlightPlanEntryLatLonWithId(
inFlightPlan, -- XPLMNavFlightPlan
inIndex, -- int
inLat, -- float
inLon, -- float
inAltitudeFt, -- int
inId, -- char
inIdLength -- int
)
See associated types:
XPLMClearFMSFlightPlanEntry
function XPLM410
This routine clears the given entry, potentially shortening the flight plan.
XPLMClearFMSFlightPlanEntry(
inFlightPlan, -- XPLMNavFlightPlan
inIndex -- int
)
See associated types:
XPLMLoadFMSFlightPlan
function XPLM410
Loads an X-Plane 11 and later formatted flightplan from the buffer into the FMS or GPS, including instrument procedures. Use device index 0 for the pilot-side and device index 1 for the co-pilot side unit.
XPLMLoadFMSFlightPlan(
inDevice, -- int
inBuffer, -- string
inBufferLen -- int
)