nyx-space / nyx

Nyx is a high fidelity, fast, reliable and validated astrodynamics toolkit library written in Rust and available in Python
https://nyxspace.com
GNU Affero General Public License v3.0
187 stars 20 forks source link

TLE parsing and SGP4 propagation #160

Open ChristopherRabotin opened 1 year ago

ChristopherRabotin commented 1 year ago

High level description

Nyx currently does not support the Two-Line Element Set (TLE) format and Simplified Perturbations Model (SGP4), both of which are commonly used in satellite tracking and collision avoidance tasks. Despite not being a high fidelity propagation, TLE parsing and SGP4 propagation are frequently utilized in space mission planning and operations. This feature is increasingly requested by users, showcasing its relevance for the Nyx project. Implementing this feature will broaden the usability of Nyx for users working in these specific use-cases and potentially attract new users who primarily rely on TLE and SGP4.

I don't seem to be able to figure out how to load and propagate a TLE, would anyone mind a code snippet or point me in the right direction?

Originally posted by @hambone01 in https://github.com/nyx-space/nyx/discussions/159

Requirements

Test plans

Design

The propagation should be available in Rust and Python. This would likely live in another module to not mix mission design and SGP4 (maybe the cola module would be fit for this so it could include other collision avoidance methods).

graph LR
A[TLE String] --> B[Orbit object]
B --> C[SGP4 Propagation]
C --> D[Nyx Trajectory]
Thomas-Oz-Dunn commented 1 year ago

I have some TLE parsing in Rust here at line 231, though it maps into my Orbit struct that uses keplerian parameters instead of state vectors, but it would be a relatively easy conversion.

I'm less familar with SGP4 interfacing, though.

Perhaps, for the good of the community, I throw my TLE parsing into a standalone lib for us both to import since it is such a common starting point for developers that may not want either of our entire packages. Have it extract just the values present, no further calculations.

Thomas-Oz-Dunn commented 1 year ago

I have some TLE parsing in Rust here at line 231, though it maps into my Orbit struct that uses keplerian parameters instead of state vectors, but it would be a relatively easy conversion.

I'm less familar with SGP4 interfacing, though.

Perhaps, for the good of the community, I throw my TLE parsing into a standalone lib for us both to import since it is such a common starting point for developers that may not want either of our entire packages. Have it extract just the values present, no further calculations.

TLE parser

https://crates.io/crates/parse-tle

https://github.com/Thomas-Oz-Dunn/parse-tle

Mapped the fields into a simple struct of each parameter, that way we each can have our own derived Orbit class.

ChristopherRabotin commented 1 year ago

Nice, thanks! I will let you know when I start working on this.

For the epoch calculations, you may wish to use hifitime since it computes the Julian dates directly and performs nanosecond precision duration arithmetics.