mako-sgp4
A Rust crate to parse and propagate General Perturbation Element Sets (GPs) using Simplified Perturbations Models (SGP4 / SDP4). Both Two-Line Elements (TLEs) and Orbit Mean-Elements Messages (OMMs) are supported. This code is implemented using the theory and equations found in History of Analytical Orbit Modeling in the U.S. Space Surveillance System by Hoots et al. Practical implementation adjustments were made based on Revisiting Spacetrack Report #3: Rev 3 by Vallado et al.
The name mako-sgp4 pays tribute to the Shortfin Mako Shark, the fastest shark species. The speed and efficiency of the SGP4 propagator make this an apt name.
Accuracy
The SGP4 propagator is a mean orbital elements propagator. At any point in time, its accuracy to the true position of an orbiting body is typically on the order of hundreds of meters to kilometers. Thus, it is not intended for high-precision operations.
mako-sgp4 is verified against the standard Vallado test cases and additional test cases generated with python-sgp4 (found in test/). In all propagation cases, mako-sgp4 agrees with both reference implementations to within 1 millimeter in position and 1 millimeter per second in velocity, per component. This is agreement with the reference SGP4 implementations, not with the true orbit.
Documentation
The full API is on docs.rs. The crate requires Rust 1.85 or newer (edition = "2024"). The math specification documents every equation the crate implements, with references to the source code, and the style guide covers contribution conventions.
# Unit tests, doctests, and default features (XML / JSON / CSV)
# TLE and OMM KVN only
# Rustdoc
Usage
Add mako-sgp4 to your projects:
Propagate a TLE to its epoch with this example:
use ;
SGP4 propagation is accomplished with one of the following functions:
sgp4_prop_delta- Propagates delta_t minutes from epochsgp4_prop_datetime- Propagates to a specified UTC datetime
Example code lives in examples/ and can be run with:
Features
TLE and OMM KVN parsing are always available. XML, JSON, and CSV OMM support are optional Cargo features but on by default.
| Feature | Formats |
|---|---|
| (none / core) | TLE, OMM KVN |
xml |
OMM XML |
json |
OMM JSON |
csv |
OMM CSV |
WebAssembly
mako-sgp4 compiles to WebAssembly so it can run in a web browser. The wasm/ directory contains JavaScript bindings for TLE and OMM KVN parsing, propagation, and ground tracks. Build them with wasm-pack:
import init from './mako_sgp4_wasm.js';
await ;
const sat = ;
const state = sat.; // [x, y, z, vx, vy, vz] 60 min after epoch, TEME [km, km/s]
const track = sat.; // [lat, lon, alt, ...] for one day [deg, deg, km]
See the wasm README for setup and the full API.
Future Work
- Fit state data to GP
- Python wrapper
References
- Revisiting Spacetrack Report #3: Rev 3 by Vallado et al
- Fundamentals of Astrodynamics and Applications by Vallado et al
- Fundamentals of Astrodynamics Github Repository by Vallado et al
- History of Analytical Orbit Modeling in the U.S. Space Surveillance System by Hoots et al
- Space-Track
- Celestrak
- python-sgp4