Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

satellite-rs

build status

A port of satellite-js to rust.

Currently unstable, and unsuitable for production use.

Cargo.toml

Since this library is currently unstable, you may want to simply grab the latest version from master.

satellite = { git = "https://github.com/richinfante/satellite-rs.git", branch = "master" }

How to use

  1. Get updated tles from a source such as celestrak.
  2. Run predictions for a specific location / time (see below.)

Example:

extern crate satellite;
extern crate chrono;
use chrono::prelude::*;

fn main() {
    // ISS TLE's
    let tle1 = "1 25544U 98067A   19070.20068744  .00000619  00000-0  17310-4 0  9990";
    let tle2 = "2 25544  51.6414 128.3903 0004102  93.2843   5.7821 15.52799004160030";

    let mut satrec = satellite::io::twoline2satrec(tle1, tle2).unwrap();

    let time = Utc::now();
    let result = satellite::propogation::propogate_datetime(&mut satrec, time).unwrap();

    println!("Position {:#?}", result.position);
    println!("Velocity {:#?}", result.velocity);
    
    // Set the Observer at 122.03 West by 36.96 North, in RADIANS
    let observer = satellite::Geodedic {
        longitude: -122.0308 * satellite::constants::DEG_2_RAD,
        latitude: 36.9613422 * satellite::constants::DEG_2_RAD,
        height: 0.370
    };

    let gmst = satellite::propogation::gstime::gstime_datetime(time);
    let sat_pos = satellite::transforms::eci_to_geodedic(&result.position, gmst);
    let position_ecf = satellite::transforms::eci_to_ecf(&result.position, gmst);
    let look_angles = satellite::transforms::ecf_to_look_angles(&observer, &position_ecf);

    println!("longitude = {}", sat_pos.latitude * satellite::constants::RAD_TO_DEG);
    println!("latitude = {}", sat_pos.longitude * satellite::constants::RAD_TO_DEG);
    println!("alt = {}", sat_pos.height * satellite::constants::KM_TO_MI);
    println!("aizmuth = {}", look_angles.azimuth * satellite::constants::RAD_TO_DEG);
    println!("elevation = {}", look_angles.elevation * satellite::constants::RAD_TO_DEG);
    println!("range = {}", look_angles.range * satellite::constants::KM_TO_MI);
}

Known Issues:

  • Deep-space calculations appear to be slightly off. Cause is currently unknown
  • Many portions are currently untested.

Todo List:

  • Refactor code to allow for easier testing
  • Add tests for remaining modules to ensure proper port
    • constants.rs
    • ext.rs
    • doppler_factor.rs
    • transforms.rs partial
    • io.rs
    • propogation/dpper.rs
    • propogation/dscom.rs
    • propogation/dsinit.rs
    • propogation/dspace.rs
    • propogation/gstime.rs
    • propogation/initl.rs
    • propogation/sgp4.rs
    • propogation/sgp4init.rs

MIT License. Derivative of satellite-js and sgp4

About

A rust sgp4 satellite tracking library based on satellite-js

Resources

License

Releases

No releases published

Packages

No packages published

Languages