GPS internals: Difference between revisions

Jump to navigation Jump to search
m
Robot: Cosmetic changes
m (Robot: Cosmetic changes)
Line 1: Line 1:
GPS internals
GPS internals


==Introduction==
== Introduction ==


Although the code is named 'GPS', it is intended to be used to support a wide range of related devices, such as INS or FMS systems. A generic name such as 'navigation computer' might be better, but renaming the properties and code at this point would be awkward.
Although the code is named 'GPS', it is intended to be used to support a wide range of related devices, such as INS or FMS systems. A generic name such as 'navigation computer' might be better, but renaming the properties and code at this point would be awkward.


The core GPS code attempts to provide simple, building block functions that can be easily composed in Nasal or XML to model the behaviour of particular real world instruments. This page should be read in conjunction with the [[Route_manager_internals|route manager internals page]].
The core GPS code attempts to provide simple, building block functions that can be easily composed in Nasal or XML to model the behaviour of particular real world instruments. This page should be read in conjunction with the [[Route manager internals|route manager internals page]].


It is assumed the reader is familiar with using the GPS in flight, as detailed in the [[GPS|user's manual]].
It is assumed the reader is familiar with using the GPS in flight, as detailed in the [[GPS|user's manual]].
Line 11: Line 11:
The GPS is a work in progress - if you have problems with a feature, or think functionality is missing, don't work around the problem yourself, get in touch. It's far better to support a feature used by 50% of real-world devices, in the core code, than to duplicate it many times over. (Of course, if the feature is only found in ''one'' real world device, it may not be added to the core code)
The GPS is a work in progress - if you have problems with a feature, or think functionality is missing, don't work around the problem yourself, get in touch. It's far better to support a feature used by 50% of real-world devices, in the core code, than to duplicate it many times over. (Of course, if the feature is only found in ''one'' real world device, it may not be added to the core code)


==Concepts==
== Concepts ==


The code computes basic positional information, derived from FG's knowledge of the aircraft position (i.e the <tt>/position</tt> properties). There is no attempt made to accurately simulate GPS position calculation - in the future an error function will be used (optionally) to reduce the accuracy of the GPS indicated position.
The code computes basic positional information, derived from FG's knowledge of the aircraft position (i.e the <tt>/position</tt> properties). There is no attempt made to accurately simulate GPS position calculation - in the future an error function will be used (optionally) to reduce the accuracy of the GPS indicated position.
Line 17: Line 17:
From the indicated position, many other values are derived - ground track, speed, vertical speed, odometer and so on. All these values can be seen in the basic /gps property tree, and are hopefully self-explanatory.
From the indicated position, many other values are derived - ground track, speed, vertical speed, odometer and so on. All these values can be seen in the basic /gps property tree, and are hopefully self-explanatory.


===Active waypoints===
=== Active waypoints ===


The active waypoint is available as <tt>gps/wp/wp[1]</tt>, for historical reasons. Various interesting values are computed for the active waypoint, such as distance, bearing and so on.
The active waypoint is available as <tt>gps/wp/wp[1]</tt>, for historical reasons. Various interesting values are computed for the active waypoint, such as distance, bearing and so on.
Line 27: Line 27:
In the future, when other kinds of leg exist, the active waypoint may not have a defined position; for example if the active leg is a hold, [[DME arc]] or procedure turn.
In the future, when other kinds of leg exist, the active waypoint may not have a defined position; for example if the active leg is a hold, [[DME arc]] or procedure turn.


===Commands and the scratch===
=== Commands and the scratch ===


The GPS has a simple command system - it expects the properties under <tt>gps/scratch</tt> to be populated with some parameters, and then a command property to be set. Information is also returned via the <tt>gps/scratch</tt> properties. For example, to go direct to a waypoint, it is loaded into the scratch, and a 'direct' command executed. To find the nearest VOR, set <tt>scratch/type</tt> to <tt>vor</tt> and execute a <tt>nearest</tt> command. The scratch will be updated with information about the result (if one was found) - and then a 'direct' or 'obs' command can be executed to use the waypoint.
The GPS has a simple command system - it expects the properties under <tt>gps/scratch</tt> to be populated with some parameters, and then a command property to be set. Information is also returned via the <tt>gps/scratch</tt> properties. For example, to go direct to a waypoint, it is loaded into the scratch, and a 'direct' command executed. To find the nearest VOR, set <tt>scratch/type</tt> to <tt>vor</tt> and execute a <tt>nearest</tt> command. The scratch will be updated with information about the result (if one was found) - and then a 'direct' or 'obs' command can be executed to use the waypoint.


==Command List==
== Command List ==


More commands can be added! Let James know what you want (and why) and it can probably be done.
More commands can be added! Let James know what you want (and why) and it can probably be done.
Line 49: Line 49:
: : maximum number of nearby waypoints to load. Default is 1, larger values are supported, but there may be noticeable delays if this is set to 100 or similar - testing is needed in this area.
: : maximum number of nearby waypoints to load. Default is 1, larger values are supported, but there may be noticeable delays if this is set to 100 or similar - testing is needed in this area.
: ; type
: ; type
: : a type string. 'any', 'all' or an empty value mean all types
: : a type string. 'any', 'all' or an empty value mean all types


;search
;search
: load waypoints by matching ident. The following parameters are supported:
: load waypoints by matching ident. The following parameters are supported:
: ;type
: ;type
: : as for 'nearest'
: : as for 'nearest'
: ;query
: ;query
: : the string to search on
: : the string to search on
: ; order-by-range
: ; order-by-range
: : a flag indicating if matches should be returned sorted by distance (the default) or alphabetically
: : a flag indicating if matches should be returned sorted by distance (the default) or alphabetically
: ;exact
: ;exact
: : a flag indicated if matches must be exact (true) or partial (false). In
: : a flag indicated if matches must be exact (true) or partial (false). In
Line 92: Line 92:
: : the route index to delete
: : the route index to delete


==Configuration==
== Configuration ==


Various properties exist under <tt>gps/config</tt> to control behaviour. They can be adjusted at any time, and depend partly on the real-world insturment being modelled, and partly on installed aircraft performance (eg, turn rate). The default values are generally acceptable.
Various properties exist under <tt>gps/config</tt> to control behaviour. They can be adjusted at any time, and depend partly on the real-world insturment being modelled, and partly on installed aircraft performance (eg, turn rate). The default values are generally acceptable.
Line 110: Line 110:


;drive-autopilot
;drive-autopilot
: Indicates if the GPS should automatically update /autopilot/target-altitude-ft and /autopilot/target-heading-deg whenever the active waypoint changes. This property is true in the default GPS installation, but should be disabled in any real-world instrument, since it is entirely unrealistic! It exists for compatibility with older versions of the GPS and route-manager code.
: Indicates if the GPS should automatically update /autopilot/target-altitude-ft and /autopilot/target-heading-deg whenever the active waypoint changes. This property is true in the default GPS installation, but should be disabled in any real-world instrument, since it is entirely unrealistic! It exists for compatibility with older versions of the GPS and route-manager code.


==Positional Source==
== Positional Source ==
The GPS code is entirely agnostic to how the primary position is obtained; hence calling the code a GPS is inaccurate, but convenient. 'Navigation computer' is a better name. In simple GPS mode, the position value is read directly from the <tt>/position</tt> properties, i.e the actual simulation position of the aircraft.
The GPS code is entirely agnostic to how the primary position is obtained; hence calling the code a GPS is inaccurate, but convenient. 'Navigation computer' is a better name. In simple GPS mode, the position value is read directly from the <tt>/position</tt> properties, i.e the actual simulation position of the aircraft.


Navigation menu