[][src]Module nyx_space::celestia

Provides the solar system planets, and state and (later) ephemeride management.

State creation and management

extern crate hifitime;
extern crate nyx_space as nyx;

fn main(){
    use hifitime::Epoch;
    use nyx::celestia::{Cosm, Geoid, State};
    let cosm = Cosm::from_xb("./de438s");
    // In this case, we're creating these states around a Geoid which is Earth.
    // But for simplicity, we're actually going to use the GMAT value for Earth GM (de438s has a slightly different value).
    let mut earth_geoid = cosm.geoid_from_id(399);
    earth_geoid.gm = 398_600.441_5;
    let dt = Epoch::from_mjd_tai(21545.0);
    let cart = State::<Geoid>::from_cartesian(
            5_946.673_548_288_958,
            1_656.154_606_023_661,
            2_259.012_129_598_249,
            -3.098_683_050_943_824,
            4.579_534_132_135_011,
            6.246_541_551_539_432,
            dt,
            earth_geoid,
    );

    let kep = State::<Geoid>::from_keplerian(
           7_712.186_117_895_041,
           0.158_999_999_999_999_95,
           53.75369,
           1.998_632_864_211_17e-5,
           359.787_880_000_004,
           25.434_003_407_751_188,
           dt,
           earth_geoid
    );
    // We can check whether two states are equal.
    if cart != kep {
        dbg!("{:?}", cart-kep);
        panic!("This won't happen");
    }
    // Of more interest, we can fetch specific orbital elements.
    println!("sma = {} km   inc = {} degrees", cart.sma(), cart.inc());
    // Note that the state data is stored as X, Y, Z, VX, VY, VZ.
    // Hence, the following print statement may display some rounded values despite
    // being created with fixed values. GMAT has the same "issue"
    // (but `nyx` won't change your script).
    println!("ecc = {} km   RAAN = {} degrees", kep.ecc(), cart.raan());
}

Modules

bodies

Known planets IDs defined for ease of access. All Cosm objects may be accessed via Cosm directly.

eclipse

The eclipse module allows finding eclipses and (conversely) visibility between a state and another one (e.g. a planet or the Sun).

orientations

Known orientation IDs defined for ease of access. All Cosm objects may be accessed via Cosm directly.

Structs

Cosm
EXBID
FrameID
Geoid
IoError

The error type for I/O operations of the Read, Write, Seek, and associated traits.

Spacecraft
State

State defines an orbital state parameterized by a CelestialBody.

Enums

CosmError
LocalFrame

Constants

AU

Astronomical unit, in kilometers, according to the IAU.

ECC_EPSILON

If an orbit has an eccentricity below the following value, it is considered circular (only affects warning messages)

SPEED_OF_LIGHT

Speed of light in meters per second

Traits

CelestialBody

CelestialBody represents a celestial body.

Frame

Functions

load_ephemeris

Loads the provided input_filename as an EXB

load_frames

Loads the provided input_filename as an FXB