Moving-Map Navigator: C-version

This description is of the full working version of the automatic global nav­igator of which the previously described applet was a demonstrator. It is written entirely in 'C' using only the X11 windowing facility: no external graphics or widget libraries are neces­sary. This program may be compiled from the sup­plied source code and run on any Unix-type oper­ating system such as System V, BSD or Linux. [PDF]

To run this program you must first compile it from the source code. Create a new directory in a convenient place. Download the file Move it to your new directory. Unzip the file. The zip file contains the source code nav.c plus the routes data files. Open nav.c in a text editor. I prefer gedit because of its good source high­lighting. Open a terminal. Do a 'cd' to your new dir­ectory. The compiling and running instruc­tions are near the beginning of the source listing.

The full version of Global Navigator II has a smaller [500 x 400 pixel] window area than the shortened version but its content is distributed across 8 tabs. The different tabs are selected by clicking on the respective tab buttons across the top of the window area.

A detailed description of the Global Navigator's operation and navigation geometry has been given for the short C-version. These are essentially the same for the full version. Consequently I only cover here the operating instructions for the full version. In the following illustrations, the window content only is shown, without the window frame. A full-size image can be got by clicking on the small illustration.

The Map Tab

Map Tab of Global Navigator II originated and written in 'C' by Robert John Morton YE572246C. Most of this tab is occupied by a square dark blue map panel. The aircraft is represented by a cross at the centre of the map panel. The front of the aircraft always faces exactly in the upward vertical direction on the map panel. The map displays named geographic features that are currently within map range of the aircraft. Some, but by no means all, of these geographic features are designated waypoints that mark the route the aircraft is flying. All visible geographic features move downwards as the aircraft proceeds along its route, while the aircraft remains 'stationary' at the map's central cross. The small compass annunciator at the bottom right of the map indicates 'North' relative to the direction in which the aircraft is pointing.

The items displayed on the left of the tab area show the current values of the navigational parameters. The items in the lower part show the position, height, speed, headings and turn rate of the aircraft. Those above show the position, height, distance, bearing and selected radial of approach or recession pertaining to the waypoint to which the aircraft is currently 'locked on'.

Across the bottom of the tab is a set of 8 control buttons, which may be actioned by clicking on them with the mouse. Separate GO and STOP buttons operate in mutual exclusion. This is, if the flight is in progress, clicking on the STOP button stops the flight but otherwise does nothing. Similarly, if the flight is stopped, or has not yet been started, clicking the GO button starts the flight. Otherwise it does nothing. Clicking the NEXT or PREV buttons respectively stop the flight if it is in progress and move the aircraft to the next or previous waypoint in the route. The RESET button stops the flight and sets the aircraft back to the beginning of the route. The HELP button opens this Web-based narrative.

The Route Tab

Route Tab of Global Navigator II originated and written in 'C' by Robert John Morton YE572246C. All the routes currently on file are listed here. There is one line of information for each route. The routes are numbered from zero upwards. The route number is the first item on each line. This is followed by two 3-digit numbers. These are respectively the primary runway headings of the airport at which the route begins and of the airport at which it terminates. This is followed by the route name, which comprises the names of the origin and destination airports. Provision is made within the software for up to 100 routes, although this can be extended.

If there are more than 12 routes on file, a scroll bar appears on the right of the list so that all route entries may be seen by scrolling the list using the mouse wheel. A route is selected by clicking on its name. The selected route [the one that the aircraft will fly when the GO button is pressed on the MAP tab] is highlighted in bright white.

On the left of this tab are two selector menus. The upper one allows you to select the refresh period of the map. That is, how often the position of the aircraft relative to all the visible geographic features [including waypoints] is re-computed. For transoceanic legs [between one waypoint and the next] a 5-second update period is more than adequate. For short-haul and approach manoeuvres, a half-second [500 millisecond] update period is appropriate. A 100 millisecond update period is only required when the ATAV function is in use. The lower selector menu allows you to select the map scale for the MAP tab. In general, the 200 x 200 kilometre map is ideal. For approach in tight corridors, the 50 x 50 kilometre scale is useful. The 500 x 500 kilometre scale is ideal for waiting for first sight of your landfall waypoint after a long transoceanic leg.

The message line is where the program displays messages regarding the state of a flight and warning/error conditions. Advisory messages are displayed in green, cautionary messages in yellow and error conditions in red.

The WIND button [bottom left] enables a simulated wind to act upon the aircraft during flight. Only a single value is available. This facility could be augmented by implementing real-time access to a global wind model, which would return wind speed and direction when given the aircraft's current position and height.

The Waypoints Tab

Waypoints Tab of Global Navigator II originated and written in 'C' by Robert John Morton YE572246C. This tab contains a list of the waypoints that make up the currently selected route. A list comprising more than 16 waypoints may be scrolled using the mouse wheel. Like routes, the waypoints within a route are numbered, starting with zero. Each line of the list con­tains the details of 1 waypoint. Geographic features that aren't waypoints are excluded from this list. The waypoint's name is limited to 20 characters. The waypoint's latitude & longitude in degrees:minutes:seconds are then shown, followed by its elevation above sea level in metres.

Clicking on a waypoint line causes it to become highlighted in bright white. This action repositions the aircraft to the highlighted waypoint, as can be seen by switching back to the MAP tab. The software currently provides for up to 50 waypoints in any given route, although this can be extended if required.

The Geoid Tab

Geoid Tab of Global Navigator II originated and written in 'C' by Robert John Morton YE572246C. The Earth is almost spherical, but not quite. At sea level, its equatorial radius is 6378137 metres; its polar radius is 6356752 metres — a difference of only 21385 metres. Earth's sea level radius may thus be written as 6367445 ±10693 metres: that's only ± 1·21 times the height of Mount Everest. Thus, its deviation from being perfectly spherical is very small. But, for accurate navigation on a global scale, it is necessary to take account of this deviation. The Vincenty method, used by this program to calculate distance and bearing thus treats the Earth as an ellipsoid.

Notwithstanding, though it be a slightly flattened sphere, the Earth is not a perfect oblate ellipsoid. This is because the distribution of materials of different densities that make up the planet is far from homogeneous. This causes variations in gravitational effects. As a result, the Earth is pear-shaped. The bottom of the pear is at the South Pole and the neck of the pear is at the North Pole. Consequently, the mean ellipsoid of the Earth does not fit equally well — or even adequately — in all parts of its surface.

Over the past century and a half, therefore, various navigators and mathematicians have calculated separate ellipsoidal models [called geoids] that fit well for specific regions of the globe. The most notable and established of these are the 18 listed on the left of this tab. It is up to you to research and select the one that best suits the routes you fly.

When the selector on the left is set to MANUAL, you may click on the name of the geoid you wish the Vincenty distance and bearing function to use. When you do so, it will become highlighted in bright white as the geoid currently in effect. When AUTOMATIC is selected, the program uses the current latitude and longitude of the aircraft to select automatically the best geoid to use. The selection mechanism is, however, quite rudimentary in the present implementation. Perhaps I shall improve it in the future.

The Input Tab

Input Tab of Global Navigator II originated and written in 'C' by Robert John Morton YE572246C. The input tab monitors the input stream of regular real-world position and height up­dates from external equipment such as a GPS receiver, an inertial platform or reactive radar. The data is displayed as successive lines, each containing the aircraft's current latitude and longitude [in radians] and its height [in metres]. This data is passed to Global Navigator II via stdin, piped from an auxiliary program that reads data from the external hardware. The auxiliary program could read it in from a USB port or a bus-based expansion card.

The default is no external input, with Global Navigator II generating the aircraft's position and height input stream from its internal SIMUlated terrestrial environ­ment. Clicking the LIVE button to receive live input from stdin will cause the LIVE button to illuminate in RED, indicating that LIVE input is not implemented in this demonstration version of Global Navigator II. SIMUlated input remains in effect.

The Output Tab

Output Tab of Global Navigator II originated and written in 'C' by Robert John Morton YE572246C. During a flight, the output tab displays the flight direction commands emitted by Global Navigator II. By default, these commands go nowhere. However, clicking on the STDOUT button, causes the program to send these commands to stdout. From here they can be piped to another auxiliary program that sends them on to a real-world flight director computer. Clicking on the FILE button will cause the program to send the commands to a file called output.txt, which could be configured as a device driver for an external flight director.

For convenience, the GO and STOP buttons appear on this tab so that the current flight can be paused and re-started from here.

The ATAV Tab

ATAV Tab of Global Navigator II originated and written in 'C' by Robert John Morton YE572246C. This demonstration version of Global Navig­ator II does not include ATAV [attack avoid­ance] functionality. ATAV is based on an in­verse of the starling murmuration algorithm, in which the 'starlings' [enemy interceptors] are the predators and the interloper [the aircraft] is the prey. The aircraft employs the inverse murmuration algorithm to escape an orchestrated attack by the 'starlings'. ATAV can be activated manually or programmed to activate automatically in response to the trajectorial behaviour of other flying objects within the aircraft's murmuration vicinity.

ATAV manoeuvres are superimposed, as and when necessary, upon the aircraft's nominal flight path along its current route. In this demonstration version of Global Navigator II, this tab is simply left in place for completeness.

The Maintenance Tab

Maintenance Tab of Global Navigator II originated and written in 'C' by Robert John Morton YE572246C. This tab contains editing facilities for creat­ing and editing the routes and waypoints data files. Notwithstanding, these files are standard .txt files and can be created and edited directly using an external text editor such as gedit, although the format of the data is critical and must be followed exactly. This tab is not functional in this demon­stration version of Global Navigator II.

© 01 Sept 2020 Robert John Morton