celnav

Written by

in

,

Motivation

After troubles described in my note “Key flaw of modern programming paradigm” I got understanding that my apps for celestial navigation requires deep modification.

Software purposed for autonomous navigation must be autonomous itself. It must not require constant internet connection.

Moreover, it must be able to work using as minimal external dependencies as possible (preferably zero).

It must be automatic as possible and fast in operation – because in flight you have no time to search Nautical Almanacs. And, of course, it must be as precise as celestial navigation methods can be.

Same time, it was obvious that implementation of fully autonomous and zero-dependency application would require plenty of time. And additionally, total autonomy of an app for celestial navigation is not possible, because it needs regularly updated external data (for example, planetary ephemerides, star coordinates and time correction settings).

A solution for this contradiction was the architecture of my new celestial navigation library in a manner how it is implemented now.

celnav logo (created by Amiko Panda)

Features & Architecture

celnav is freeware, open-source, Python-based, low-dependency software library for autonomous celestial navigation.

It’s functional follow the library logic – the system provides to user number of externally accessible functions, which can be used from Python console, Jupyter Notebook or any other Python app. This functions includes methods for:

  • Geographical position determination via celestial navigation, triangulation and trilateration methods
  • Basic navigation routines including orthodromy calculation, waypoint calculation and estimation of “dead reckoning”
  • Auxiliary utility methods for processing time and detecting magnetic declination
  • Set of methods for position determination on the move (experimental for now)

Provided methods allows to determine your geographical position using precise clock and elevation measurement equipment (like a sextant or star tracker), with at least two sight reductions of Sun, Moon, or other navigation stars and planets mentioned in The Nautical Almanac.

Best CEP of position fix via stars – about 1/5 nmi in autonomous mode and about 1/10 nmi (~180 m) with AstroPy ephemeris.

celnav has only 4 external dependencies:

  • numpy (for vector math and matrix operations)
  • requests (for downloading star coordinates from stellar catalogs)
  • astropy (mostly as an alternative source of ephemerides)
  • setuptools (for setup and configuration purposes)

celnav provides for user two main sources of astronomical data:

  • Astropy.
  • Local “astronomical engine”.

Astropy provides more precise ephemerides, but requires connection to the Internet to gather actual data.

“Astronomical engine” utilize algorithms from “Fundamentals of Astrodynamics and Applications”, Fourth Edition, by David Vallado (src. #1) and “Astronomical Algorithms (1998), 2nd ed.” by Jean Meeus (src. #2).

For Venus, Mars, Jupiter & Saturn “astronomical engine” uses ephemerides from src. #1. For stars, “astronomical engine” uses local database, built on data from celestial object catalogues.

Data in this database is actual for epoch 2025. By command, the database can be built/update (by user choice) from:

  • Hipparcos/Tycho Catalogue
  • SIMBAD Astronomical Database
Typical CEP of celnav position determination results, in comparison with a big city

Algorithms

Celestial coordinates

Algorithms of an “astronomical engine” follows algorithms and notation from src. #1 and src. #2. During calculation of celestial coordinates algorithms count Earth rotation and secondary effects, including:

  • precession
  • nutation
  • yearly movement of stars

Sight corrections

Sight reduction algorithm counting sight corrections mostly following recommendations from Pub. No. 9 “AMERICAN PRACTICAL NAVIGATOR AN EPITOME OF NAVIGATION ORIGINALLY BY NATHANIEL BOWDITCH, LL.D.” 2019 EDITION (src. #3), including:

  • index correction of sensor
  • observer altitude
  • environment temperature
  • environment pressure
  • chosen limb (Like in src. #3 “-1”: for Sun and Moon, “0” for stars and planets)

Sight reduction

celnav using original sight reduction algorithm, optimized for computer processing.

The idea of an algorithm developed from classic cptn. Thomas H. Sumner method, as it was explained on the site of Omar Reis and in src. #3. I modified it to use with vector math which is more suitable for computer calculations.

The algorithm is calculating an offset from dead reckoning (DR) and a heading angle of a tangent of a circle of equal elevations.

As an input for algorithm we using geographical coordinates of DR ϕgdDR\phi_{gdDR} and λDR\lambda_{DR}, time tJDt_{JD} (as Julian date), time correction δUT1\delta_{UT1} and measured corrected elevation of selected celestial object elel.

From an astronomical data source we receive position vector of sighted celestial object rCO\vec{r_{CO}}.

Then, we calculating corrected time:

tJDcorr=tJD+δUT1t_{JDcorr} = t_{JD} + \delta_{UT1}

From tJDcorrt_{JDcorr} and λDR\lambda_{DR} we calculating θLST\theta_{LST} how that was described in src. #1.

Then let’s calculate DR position vector. Imply that RearthR_{earth} is Earth equatorial radius, eearthe_{earth} is Earth eccentricity and helliph_{ellip} is altitude over reference ellipsoid:

x=|Rearth(1eearth2)sinϕgdDR2+hellip|cosϕgdDRx = \left\lvert \frac {R_{earth}} {\sqrt{(1 – e_{earth}^2) \sin{\phi_{gdDR}}^2}} + h_{ellip} \right\rvert \cos{\phi_{gdDR}}
z=|Rearth(1eearth2)(1eearth2)sinϕgdDR2+hellip|sinϕgdDRz = \left\lvert \frac{R_{earth}(1 – e_{earth}^2)}{\sqrt{(1 – e_{earth}^2) \sin{\phi_{gdDR}}^2}} + h_{ellip} \right\rvert \sin{\phi_{gdDR}}
rDR=[xcosθLSTxsinθLSTz]\vec{r_{DR}} = \begin{bmatrix} x \cos{\theta_{LST}} & x \sin{\theta_{LST}} & z \end{bmatrix}

Get direction vector from DR to sighted celestial object:

d=rCO+rDR\vec{d} = \| \vec{r_{CO}} + \vec{r_{DR}} \|

Now, transform direction vector into topocentric horizon system SEZ:

R2=[cos90ϕgdDR0sin90ϕgdDR010sin90phigdDR0cos90phigdDR]R_2 = \begin{bmatrix} \cos{90-\phi_{gdDR}} & 0 & -\sin{90-\phi_{gdDR}} \\ 0 & 1 & 0 \\ \sin{90-phi_{gdDR}} & 0 & \cos{90-phi_{gdDR}} \end{bmatrix}
R3=[cosθLSTsinθLST0sinθLSTcosθLST0001]R_3 = \begin{bmatrix} \cos{\theta_{LST}} & \sin{\theta_{LST}} & 0 \\ -\sin{\theta_{LST}} & \cos{\theta_{LST}} & 0 \\ 0 & 0 & 1 \end{bmatrix}
dSEZ=(R2R3)d\vec{d_{SEZ}} = (R_2 R_3) \cdot \vec{d}

Now:

ZSEZ=[001]\vec{Z_{SEZ}} = \begin{bmatrix} 0 & 0 & 1 \end{bmatrix}
elDR=90arccosZSEZdSEZ|dSEZ|el_{DR} = 90 – \arccos{\frac{\vec{Z_{SEZ}} \cdot \vec{d_{SEZ}}}{|\vec{d_{SEZ}}|}}

From this, offset from DR Δel\Delta{el} can be expressed as:

Δel=elelDR\Delta{el} = el – el_{DR}

Further,

NSEZ=[100]\vec{N_{SEZ}} = \begin{bmatrix} -1 & 0 & 0 \end{bmatrix}

And from here, heading angle of a tangent of a circle of equal elevations β\beta will be:

β=arctg(NSEZ×dSEZ)ZSEZNSEZdSEZ\beta = \arctg{\frac {(\vec{N_{SEZ}} \cross \vec{d_{SEZ}}) \cdot \vec{Z_{SEZ}}} {\vec{N_{SEZ}} \cdot \vec{d_{SEZ}}}}

Position determination

Position determination algorithm calculating actual position as a crossing point of two tangents of a circle of equal elevations we got from two sight reductions.

Calculation of a crossing point performed via Cramer rule.

I clearly understand that this simplest approximation is not most precise method. In further versions I will improve this.

Triangulation & trilateration

Triangulation algorithm is implemented following Tienstra method. Trilateration algorithm is implementing the algorithm described in an article “Robust Trilateration Based Algorithm for Indoor Positioning Systems” by Simeon Pande and Kwame S Ibwe.

Both triangulation and trilateration methods are not getting in count curvature of the earth, so with long ranges CEP could be high.


Further improvements

Understanding that at current state celnav library have number of weaknesses, I am planning to improve it.

Main improvements will inlcude:

  • Improvements of ephemerides calculation (especially for the Moon)
  • Improvements of triangulation, trilateration, position fix algorithms
  • Minimization of dependencies (maybe as standalone fork)

Source code

Source code of the library provided at its GitHub repo.

Views: 7