13 releases

0.4.1 Jul 30, 2024
0.4.0 Jul 19, 2023
0.3.8 Mar 13, 2023
0.3.6 Jul 5, 2022
0.2.1 Nov 12, 2020

#5 in #astrophysics

Download history 41/week @ 2024-07-04 48/week @ 2024-07-11 54/week @ 2024-07-18 233/week @ 2024-07-25 116/week @ 2024-08-01 158/week @ 2024-08-08 80/week @ 2024-08-15 46/week @ 2024-08-22 72/week @ 2024-08-29 57/week @ 2024-09-05 105/week @ 2024-09-12 75/week @ 2024-09-19 207/week @ 2024-09-26 97/week @ 2024-10-03 93/week @ 2024-10-10 12/week @ 2024-10-17

425 downloads per month

MIT license

160KB
3K SLoC

C++ 1.5K SLoC // 0.4% comments Rust 1.5K SLoC // 0.0% comments

sgp4-rs

CI Status Docs Crate

This crate implements a wrapper around the C++ implementation of the SGP-4 orbital propagator as provided in the "Revisiting Spacetrack Report #3" paper (link). It provides high level bindings to the propagator library with a more modern interface.

Our approach separates the low-level unsafe bindings into the sgp4_sys module, while safe functions are exported through the library's root module. Because the underlying SGP4 implementation is thread-safe, this crate can be used in multithreaded environments and with async/await code.

We have not created bindings to every function in the library, especially as some of them are duplicative of Rust standard library functions. The core propagator functionality is exposed, and allows predicting an orbiting body's state vector at a given time from two line element data.

Building

sgp4 builds cleanly on the stable Rust channel, but does require a local C++ compiler to be present in order to build the wrapped SGP4 library.

Experimental Features

The tlegen feature adds basic support for creating custom TLEs from a set of orbital elements. This feature is subject to several important caveats, so it is not enabled by default. See the ClassicalOrbitalElements documentation for details.

The sgp4 crate is a pure Rust reimplementation of the Vallado library which this crate wraps.

Dependencies

~2.2–3.5MB
~65K SLoC