sgp

Crates.iosgp
lib.rssgp
version1.0.4
created_at2025-11-13 07:36:13.775842+00
updated_at2025-11-13 13:55:22.550516+00
descriptionSimplified General Perturbations models (SGP8/SGP4) in Rust.
homepage
repository
max_upload_size
id1930622
size88,699
Q. Chen (qchen-fdii-cardc)

documentation

README

SGP in Rust

A simple implementation of the Simplified General Perturbations models (SGP8/SGP4) in Rust.

The results are validated against the original MATLAB implementations:

License

This project is licensed under the GNU General Public License v3.0 only (GPL-3.0-only). See the LICENSE file for details.

Usage

Simple usage example.

  1. cargo add sgp to add the dependency.
  2. Use the following code to propagate a satellite using SGP4:
use sgp::sgp4;
use sgp::parse_tle_lines;

fn main() {
    let tle_line1 = "1 25544U 98067A   20344.91667824  .00016717  00000-0  10270-3 0  9003";
    let tle_line2 = "2 25544  51.6442 348.7413 0002393  85.0646 325.0584 15.49325993257145";

    let sat = parse_tle_lines(tle_line1, tle_line2).expect("Error parsing TLE lines");

    // Propagate to 60 minutes after epoch
    let (position, velocity) = sgp4(60.0_f64, &sat);

    println!("Position (km): {:?}", position);
    println!("Velocity (km/s): {:?}", velocity);
}

For SGP8 usage, use sgp::sgp8 just like sgp::sgp4.

update

  • 2025-11-23 21:50+8: remove accidentally added reference code in Matlab and related two reports.
Commit count: 0

cargo fmt