Skip to main content

Crate astrodyn_ephemeris

Crate astrodyn_ephemeris 

Source
Expand description

Planetary ephemerides backed by JPL DE-series SPK files.

Pure-Rust replacement for JEOD’s models/environment/ephemerides/ DE4xx reader. Where JEOD links a hand-rolled binary loader to JPL DE405/DE421 kernels, this crate delegates the file format and Chebyshev evaluation to the anise crate (a Rust SPICE/NAIF reimplementation) and exposes a thin, frame-tagged API on top.

§Public surface

  • Ephemeris — owns an anise::Almanac and answers position/velocity queries from .bsp files (e.g., de421.bsp, de440.bsp). All vectors are returned in J2000 ICRF, in meters and m/s, wrapped as Position<RootInertial> / Velocity<RootInertial> from astrodyn_quantities.
  • EphemerisBody — the body-identifier enum that maps JEOD’s EphemerisBody constants to anise’s NAIF integer IDs (Sun, Moon, Earth, the planets and barycenters needed by Tier 3 tests).
  • EphemerisError — fail-loudly error type for missing files, unsupported bodies, or out-of-range epochs.

§Role in the pipeline

The ephemeris populates third-body positions for gravity (Sun and Moon perturbations on Earth orbits, planet-on-planet perturbations on interplanetary trajectories) and for radiation-pressure / shadow geometry in astrodyn_interactions. JEOD source: models/environment/ephemerides/. Pure Rust, zero Bevy dependency.

§Example

Resolve DE421 via data::load (in-workspace assets/ during dev, cached fetch from the kernels-v1 GitHub Release for downstream consumers), then query the Sun’s position relative to the solar-system barycenter at J2000.0 (TDB Julian Day 2_451_545.0):

use astrodyn_ephemeris::{data, Ephemeris, EphemerisBody};

let bytes = data::load(&data::DE421)?;
let eph = Ephemeris::from_bsp_bytes(&bytes)?;
let (pos, _vel) = eph.get_state_typed(
    EphemerisBody::Sun,
    EphemerisBody::SolarSystemBarycenter,
    2_451_545.0,
)?;
// The Sun is close to the barycenter (~1 solar radius offset).
assert!(pos.raw_si().length() < 2.0e9);

Re-exports§

pub use bodies::EphemerisBody;
pub use ephemeris::Ephemeris;
pub use ephemeris::EphemerisError;

Modules§

assets
Path resolvers for the in-workspace kernel fixtures.
bodies
Solar-system body identifier enum used by crate::Ephemeris queries.
data
Catalog of ephemeris and orientation kernels distributed alongside the crate.
ephemeris
Ephemeris reader and the EphemerisError failure type.

Structs§

BodyAttitude
RootInertial → body attitude of vehicle V, witnessed unit-norm and scalar-first / left-transformation (JEOD canonical).
BodyFrame
Body (CoM-centered) frame of vehicle V. Rotates with the vehicle.
Earth
Planet marker for Earth.
Ecef
Earth-centered Earth-fixed frame (ITRF-like). Rotates with Earth.
FrameTransform
Proper rotation taking vectors expressed in From to the same vectors expressed in To.
GMST
Greenwich Mean Sidereal Time (angle, but seconds-ized by convention).
GPS
GPS Time (TAI − 19 s).
GravParam
Gravitational parameter μ = GM tagged with the source planet P.
HarmonicDegree
Spherical-harmonic degree or order index. Unitless ordinal.
InertiaTensor
Mass moment of inertia tensor (kg·m²) expressed in frame F.
IntegOrigin
The integration-frame origin: position and velocity of the integration-frame origin expressed in root-inertial coordinates.
IntegrationFrame
A body’s integration frame — a non-rotating quasi-inertial frame whose origin generally differs from the root inertial origin.
LeftTransform
r' = q r q⁻¹ — the JEOD convention.
Lvlh
Local Vertical / Local Horizontal frame relative to chief vehicle Chief. Z axis points planet-ward; Y opposes orbital angular momentum; X completes the right-handed triad (approximately along-track in near-circular orbits).
Mars
Planet marker for Mars.
MassNode
Mass-tree wildcard inertial-flavor frame for kinematic-propagation scratch state.
Moon
Planet marker for Moon.
Ned
North-East-Down topocentric frame relative to chief vehicle Chief.
NormalizedQuat
A quaternion witnessed to have unit norm at construction time.
PlanetFixed
Planet-fixed frame for any planet P. Rotates with that planet.
PlanetInertial
A particular planet’s inertial (non-rotating, J2000-aligned) frame, centered at the planet’s CoM.
Qty3
Componentwise 3-vector: each of x, y, z carries the dimension D, and the whole vector carries the frame tag F.
Quat
Quaternion tagged with its storage layout and transformation convention.
RightTransform
r' = q⁻¹ r q — the opposite of JEOD; common in many textbooks.
RootInertial
The simulation’s root inertial frame — the unique inertial node at the top of the frame tree.
ScalarFirst
Storage layout [q0, q1, q2, q3] where q0 is the scalar part (JEOD).
ScalarLast
Storage layout [x, y, z, w] where w is the scalar part (glam).
SecondsSince
Seconds elapsed in the named time scale, measured from that scale’s epoch.
SelfPlanet
Phantom marker for “this entity’s own planet” — used by ECS adapters whose per-entity components carry PlanetFixed<P> phantoms but whose planet identity is determined at runtime by the entity itself.
SelfRef
Phantom marker for “this entity’s own vehicle frame” — used by ECS adapters whose per-entity components carry frame phantoms but whose vehicle identity is determined at runtime by the entity itself.
StructuralFrame
Structural (geometric-origin) frame of vehicle V. Rotates with vehicle.
Sun
Planet marker for Sun.
TAI
International Atomic Time.
TDB
Barycentric Dynamical Time (relativistic correction to TT).
TT
Terrestrial Time (TAI + 32.184 s).
TimeConverter
Explicit converter between two time scales.
UT1
Universal Time 1 (Earth-rotation based).
UTC
Coordinated Universal Time (leap-second stepped).

Traits§

Array3Ext
Extension trait on [f64; 3] (raw component arrays from CSVs or JEOD initial conditions) producing frame-tagged 3-vectors.
F64Ext
Unit-construction extension on f64.
Frame
Compile-time reference frame tag.
Layout
Compile-time quaternion storage layout marker.
Planet
Compile-time planet tag used to parameterize planet-fixed frames.
TimeScale
Compile-time time-scale tag.
Transform
Compile-time quaternion transformation convention marker.
Vec3Ext
Extension trait on glam::DVec3 producing frame-tagged 3-vectors.
Vehicle
Compile-time vehicle tag used to parameterize vehicle-relative frames.

Type Aliases§

Acceleration
Acceleration in frame F. Base SI unit: m/s².
AngularAcceleration
Angular acceleration in frame F. Base SI unit: rad/s².
AngularMomentum
Angular momentum in frame F. Base SI unit: kg·m²/s.
AngularVelocity
Angular velocity in frame F. Base SI unit: rad/s.
Force
Force in frame F. Base SI unit: newtons.
JeodQuat
The JEOD canonical quaternion type: scalar-first, left-transformation.
Jerk
Jerk (time derivative of acceleration) in frame F. Base SI unit: m/s³.
MassFlowRate
Scalar mass-flow rate.
Position
Position in frame F (default: RootInertial). Base SI unit: meters.
SpecificAngMom
Scalar specific angular momentum.
SpecificEnergy
Scalar specific energy.
Torque
Torque in frame F. Base SI unit: N·m.
Velocity
Velocity in frame F. Base SI unit: m/s.