[][src]Crate sgp4

This crate implements the SGP4 algorithm for satellite propagation.

It also provides methods to parse both Two-Line Element Set (TLE) and Orbit Mean-Elements Message (OMM) data.

A UTF-8 transcript of the mathematical expressions that compose SGP4 can be found in the repository https://github.com/neuromorphicsystems/sgp4.

Example

The following standalone program downloads the lastest stations OMMs from Celestrak and predicts the stations' positions and velocities after 12 h and 24 h.

fn main() -> sgp4::Result<()> {
    let response = ureq::get("https://celestrak.com/NORAD/elements/gp.php")
        .query("GROUP", "stations")
        .query("FORMAT", "json")
        .call();
    if response.error() {
        Err(sgp4::Error::new(format!(
            "network error {}: {}",
            response.status(),
            response.into_string()?
        )))
    } else {
        let elements_group: Vec<sgp4::Elements> = response.into_json_deserialize()?;
        for elements in &elements_group {
            println!("{}", elements.object_name.as_ref().unwrap());
            let constants = sgp4::Constants::from_elements(elements)?;
            for hours in &[12, 24] {
                println!("    t = {} min", hours * 60);
                let prediction = constants.propagate((hours * 60) as f64)?;
                println!("        r = {:?} km", prediction.position);
                println!("        ṙ = {:?} km.s⁻¹", prediction.velocity);
            }
        }
        Ok(())
    }
}

More examples can be found in the repository https://github.com/neuromorphicsystems/sgp4/tree/master/examples.

Structs

Constants

Propagator variables calculated from epoch quantities and used during propagation

Elements

General perturbations orbital data parsed from a TLE or OMM

Error

Represents an SGP4 error

Geopotential

Model of the Earth radius and gravitational field

Orbit

The Brouwer orbital elements

Prediction

Predicted satellite position and velocity after SGP4 propagation

ResonanceState

Represents the state of the deep space resonnance integrator

Enums

Classification

A satellite's elements classification

Constants

WGS72

The geopotential model used in the AFSPC implementation

WGS84

The geopotential model recommended by the IAU

Functions

afspc_epoch_to_sidereal_time

Converts an epoch to sidereal time using the AFSPC expression

iau_epoch_to_sidereal_time

Converts an epoch to sidereal time using the IAU expression

parse_2les

Parses a multi-line TL/2LE string into a list of Elements

parse_3les

Parses a multi-line TL/3LE string into a list of Elements

Type Definitions

Result

The result type returned by SGP4 functions