Astrodynamics coordinate frame transforms
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

OCaml 94.6%
Dune 1.2%
Other 4.2%
36 1 0

Clone this repository

https://tangled.org/gazagnaire.org/ocaml-coordinate https://tangled.org/did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-coordinate
git@git.recoil.org:gazagnaire.org/ocaml-coordinate git@git.recoil.org:did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-coordinate

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

coordinate#

Astrodynamics coordinate frame transforms.

Conversions between standard reference frames used in satellite operations: TEME (SGP4 output), ECEF (Earth-fixed), J2000/EME2000 (inertial), and geodetic (lat/lon/alt). Includes WGS-84 constants and GMST computation.

Installation#

Install with opam:

$ opam install coordinate

If opam cannot find the package, it may not yet be released in the public opam-repository. Add the overlay repository, then install it:

$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install coordinate

Usage#

(* Convert SGP4 TEME output to geodetic coordinates. *)
let report_position ~unix_time (teme_pos : Vec3.t) =
  let gmst = Coordinate.gmst_of_unix unix_time in
  let ecef = Coordinate.teme_to_ecef ~gmst teme_pos in
  let geo = Coordinate.ecef_to_geodetic ecef in
  Fmt.pr "Lat: %.4f  Lon: %.4f  Alt: %.1f km@."
    geo.lat geo.lon geo.alt

API Overview#

  • type vec3 -- Cartesian position/velocity vector (km or km/s)
  • type geodetic -- lat (deg), lon (deg), alt (km)
  • earth_radius, earth_mu, earth_j2 -- WGS-84 constants
  • gmst_of_unix, gmst -- Greenwich Mean Sidereal Time (IAU 1982)
  • teme_to_ecef, ecef_to_teme -- TEME/ECEF rotation via GMST
  • j2000_to_ecef, ecef_to_j2000 -- J2000/ECEF rotation
  • ecef_to_geodetic -- Bowring's iterative method on WGS-84 ellipsoid
  • geodetic_to_ecef -- Geodetic to ECEF
  • teme_to_geodetic -- TEME to geodetic (convenience)

License#

ISC