sgp4
is a Golang translation of the C++ astrodynamics algorithm publsihed by CelesTrak, written by David Vallado on 28 Jun 2005, and based on the methodology originally published through the AIAA Spacetrack Report #3.
sgp4
was created as a learning project and no assurances are offered on the accuracy of this product. This is not actively maintained.
sgp4
takes one of two inputs. First is a struct derived from the Orbit Mean-Elements Message (OMM), the second is by a Two Line Element (TLE).
These functions take an OMM or TLE input and return a pointer to the sgp4 Satrec coefficients that can be used to propogate the orbital elements.
func OMMinit(o *OMM) *satrec
Where the OMM
struct is defined as and map directly to the space-track.org OMM datatype.
type OMM struct {
NORAD_CAT_ID string // "44071"
EPOCH string // "2023-11-30T14:51:58.008096"
MEAN_MOTION float64 // 1.00271227
MEAN_MOTION_DOT float64 // 0.00000055
MEAN_MOTION_DDOT float64 // 0.0
BSTAR float64 // 0.0
INCLINATION float64 // 0.0155
RA_OF_ASC_NODE float64 // 354.7718
ECCENTRICITY float64 // 0.00003150
ARG_OF_PERICENTER float64 // 254.5248
MEAN_ANOMALY float64 // 103.2389
}
func TLEinit(tle1, tle2 string) *satrec
Propogate
takes a pointer to an initialized satrec
struct and a time at propogation. Note that error increases the further the time diverges from the EPOCH.
func Propogate(s *satrec, tprop time.Time) (eci, v Vector)
Where eci
is the current position in the Earth Centered Inertial frame and the corresponding v
velocity vectors.
Converts Earth Centered Inertial to Latitude, Longitude, and Altitude at the identified t
time.
func ECItoLLA(eci Vector, t time.Time) LLA
Given a satellite position eci
, observer position obs
(in LLA), and time.
func ECItoLookAngles(eci Vector, obs LLA, t time.Time) (as, rg, el float64)
Unit tests were built by taking individual function inputs and outputs from the initial C++ libary.