SpaceDust
A comprehensive astrodynamics library for Rust, providing tools for satellite tracking, orbital mechanics, coordinate transformations, and ground-based observation calculations.
Features
- Time Systems: Conversions between UTC, TAI, TT, Julian Date, GPS, and GMST
- Coordinate Frames: Transformations between ECI J2000, TEME, ECEF, and Geodetic coordinates
- Orbital Elements: Conversions between Cartesian state vectors and Keplerian elements
- TLE Parsing: Parse and propagate Two-Line Element Sets using SGP4
- Celestial Bodies: Sun and Moon position calculations
- Ground Observations: Azimuth/Elevation and Right Ascension/Declination calculations
- High Performance: Efficient numerical operations suitable for real-time applications
Installation
Add this to your Cargo.toml:
[]
= "0.1"
Optional Features
serde- Enable serialization/deserialization supportnetwork- Enable network features for fetching TLE datafull- Enable all optional features
[]
= { = "0.1", = ["full"] }
Quick Start
Satellite Tracking
use Tle;
use ;
use Observations;
use Utc;
// Parse a TLE (ISS example)
let line1 = "1 25544U 98067A 24001.50000000 .00016717 00000-0 10270-3 0 9002";
let line2 = "2 25544 51.6400 208.1200 0001234 85.0000 275.0000 15.48919100123456";
let tle = parse.unwrap;
// Propagate to current time
let epoch = now;
let teme_state = tle.propagate.unwrap;
// Convert to ECI J2000
let eci_state = teme_state.to_eci;
// Define a ground observer (Denver, CO)
let observer = new;
// Compute observation angles
let az_el = compute_az_el;
println!;
Time System Conversions
use ;
use Utc;
let now = now;
// Convert to Julian Date
let jd = from_utc;
println!;
// Convert between time systems
let tai = TAIfrom_utc;
let tt = TTfrom_tai;
Coordinate Transformations
use ;
use Utc;
// Create an ECI state (position in km, velocity in km/s)
let eci = new;
// Convert to ECEF
let epoch = now;
let ecef = eci.to_ecef;
// Convert to Geodetic (lat/lon/alt)
let geodetic = ecef.to_geodetic;
println!;
Keplerian Elements
use ;
// Create from Cartesian state
let eci = new;
let elements = from_cartesian;
println!;
println!;
println!;
Celestial Body Positions
use ;
use Utc;
let epoch = now;
// Get Sun position in ECI coordinates
let sun_pos = position_eci;
println!;
// Get Moon position in ECI coordinates
let moon_pos = position_eci;
println!;
Modules
| Module | Description |
|---|---|
time |
Time system conversions (UTC, TAI, TT, JD, GPS, GMST) |
state |
Coordinate frames and state vectors (ECI, TEME, ECEF, Geodetic, Keplerian) |
tle |
Two-Line Element parsing and SGP4 propagation |
observations |
Ground-based observation calculations (Az/El, RA/Dec) |
bodies |
Celestial body positions (Sun, Moon, Earth) |
constants |
Physical and astronomical constants |
math |
Vector and matrix operations |
data |
Data handling utilities |
Accuracy
- Time conversions: Sub-microsecond accuracy
- Coordinate transformations: Suitable for operational satellite tracking
- SGP4 propagation: Standard SGP4/SDP4 accuracy (typically < 1 km for well-maintained TLEs)
- Celestial positions: Low-precision algorithms suitable for most applications
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.