Skip to main content

sidereon_core/
lib.rs

1//! # sidereon-core
2//!
3//! The complete Sidereon engine in one crate. It folds the numerical
4//! astrodynamics core (orbit propagation, force models, frames, time, SGP4)
5//! together with the GNSS domain layer (SP3, broadcast ephemeris, multi-GNSS
6//! positioning, RTK/PPP, ionosphere/troposphere, DOP).
7//!
8//! - The propagation/astro layer is always present under the [`astro`] module.
9//! - The GNSS layer lives behind the default-on `gnss` cargo feature, so a
10//!   propagation-only consumer can build with `--no-default-features` (plus
11//!   any astro features it wants) and never compile the IONEX/SP3 parsers.
12//!
13//! The GNSS façade is organized by user-facing tasks:
14//!
15//! - [`ephemeris`] - precise SP3 and broadcast ephemeris products,
16//! - [`rinex`] - RINEX navigation/observation parsing and CRINEX decoding,
17//! - [`antex`] - ANTEX receiver and satellite antenna calibration parsing,
18//! - [`combinations`] - observable linear combinations such as ionosphere-free,
19//! - [`observables`] - forward range, Doppler, and azimuth/elevation prediction,
20//! - [`velocity`] - receiver velocity and clock-drift solve from range-rate data,
21//! - [`positioning`] - single-point positioning and DOP diagnostics,
22//! - [`dgnss`] - code-differential pseudorange correction and rover pairing,
23//! - [`quality`] - pseudorange weighting, RAIM, and FDE integrity checks,
24//! - [`observation_qc`] - RINEX observation completeness and signal rollups,
25//! - [`signal`] - GPS C/A code generation, correlation, and acquisition,
26//! - [`ppp_corrections`] - static-arc PPP correction precomputation,
27//! - [`atmosphere`] - ionosphere and troposphere corrections,
28//! - [`scenario`] - deterministic synthetic GNSS observation scenarios,
29//! - [`orbit`] - compact reduced-orbit fitting/evaluation.
30//!
31//! Implementation modules (`sp3`, `rinex_nav`, `spp`, etc.) are crate-private.
32//! This is a clean public surface rather than a compatibility shim around the
33//! original implementation-shaped module layout.
34//!
35//! ## Units policy (internal representation)
36//!
37//! All quantities are stored and computed in **SI base units**, with the frame
38//! and datum encoded in the type name (per the spec's frames-in-the-type-system
39//! rule), never hidden behind a bare `position_m`:
40//!
41//! - **Length / position:** meters (`_m`). SP3 positions are ITRF/IGS-frame
42//!   ECEF meters; SPP receiver positions are WGS84/ITRF-compatible ECEF meters.
43//!   (The [`astro`] state layer works in kilometers; conversions happen
44//!   explicitly at the boundary, never implicitly.)
45//! - **Time / clock:** seconds (`_s`). Epochs are represented by the [`astro`]
46//!   time family (`Instant`/`TimeScale`), always scale-tagged; there is no bare
47//!   ambiguous epoch.
48//! - **Velocity:** meters per second (`_m_s`).
49//! - **Angles:** radians (`_rad`) internally. Degrees appear only at I/O edges
50//!   and are named `_deg`.
51//! - **Frequency:** hertz (`_hz`).
52//!
53//! Field and parameter names carry the unit suffix so the unit is visible at
54//! every call site. Matrix/vector linear algebra uses `nalgebra`
55//! (`DMatrix`/`DVector`) per the spec.
56
57extern crate self as sidereon_core;
58
59// ---------------------------------------------------------------------------
60// Astro / propagation layer. Always present. The GNSS layer below depends on
61// it via `crate::astro::*`.
62// ---------------------------------------------------------------------------
63
64mod validate;
65
66#[cfg(all(test, sidereon_repo_tests))]
67mod test_parity;
68
69pub mod artifact_bytes;
70pub mod astro;
71pub(crate) mod format;
72
73pub use artifact_bytes::DigestProvenance;
74
75// ---------------------------------------------------------------------------
76// GNSS domain layer. Behind the default-on `gnss` feature so a propagation-only
77// consumer can opt out. Additional product modules are added as each lands.
78// ---------------------------------------------------------------------------
79
80mod ambiguity; // shared RTK/PPP cycle-slip policy + wide-lane/narrow-lane prep
81mod antenna; // shared ANTEX PCV/PCO zenith/azimuth interpolation kernels
82pub mod antex; // ANTEX receiver/satellite antenna parser + PCO/PCV lookup
83pub mod araim; // advanced RAIM multi-hypothesis protection levels
84pub mod bias; // Bias-SINEX and DCB bias products
85mod broadcast; // broadcast-ephemeris (GPS LNAV / Galileo I/NAV) orbit + clock
86pub mod broadcast_comparison; // broadcast-vs-precise (SISRE orbit/clock) accuracy
87pub mod carrier_phase; // carrier-phase combinations, cycle-slip detection, Hatch smoothing
88pub mod clock_stability; // Allan-family receiver clock stability estimators
89pub mod constants; // shared physical/time constants (used by astro + gnss)
90pub mod constellation; // GNSS constellation identity catalog (CelesTrak/NAVCEN)
91mod crinex; // Hatanaka (CRINEX) observation-file decoder
92pub mod data; // sans-IO GNSS product filename and archive URL catalog
93pub mod dop; // dilution-of-precision geometry (GDOP/PDOP/HDOP/VDOP/TDOP)
94pub mod error_metrics; // covariance-derived CEP, radial, and ellipse metrics
95pub mod exact_cache; // exact-product cache identity binding and atomic publication
96pub mod frequencies; // canonical GNSS carrier-frequency table
97mod glonass; // GLONASS PZ-90.11 state-vector RK4 propagation
98pub mod has; // Galileo HAS MT1 correction payload decode/encode
99mod ionex; // Klobuchar broadcast model + IONEX ionospheric maps
100pub mod navigation; // navigation-message bit-level codecs (GPS LNAV)
101pub mod nmea; // NMEA 0183 sentence parsing, stream grouping, and GGA writing
102pub mod ntrip; // NTRIP client sans-I/O request, response, and stream handling
103pub mod observables; // forward GNSS observable prediction
104pub mod ppp_corrections; // static-arc PPP correction tables
105pub mod precise_positioning; // static multi-epoch PPP float solve
106mod reduced_orbit; // compact mean-element orbit approximation (fitted)
107mod rinex_clock; // RINEX clock satellite-bias parsing and interpolation
108mod rinex_common; // shared RINEX header concepts (time-system label mapping)
109mod rinex_nav; // RINEX 3 navigation-message parsing (GPS/Galileo broadcast)
110mod rinex_obs; // RINEX 3 observation parsing + single-frequency pseudoranges
111mod rinex_qc; // RINEX observation/navigation lint and mechanical repair
112pub mod rtcm; // RTCM 3 differential-GNSS stream decode/encode (MSM, station, ephemeris)
113pub mod rtk; // RTK double-difference construction
114pub mod sbas;
115pub mod sbas_pl; // SBAS single-hypothesis protection levels
116pub mod scenario; // scenario-driven synthetic GNSS observable generation
117pub mod sidereal; // repeating-geometry residual filtering and period diagnostics
118pub mod signal; // GPS C/A code, coherent correlation, and acquisition
119pub mod source_localization; // ToA/TDOA source localization from arrival times
120mod sp3; // SP3-c / SP3-d parser + arbitrary-epoch interpolation
121mod spp; // single-point positioning (least-squares PVT)
122pub mod ssr; // SSR correction store and corrected broadcast ephemeris source
123pub mod staleness; // product-staleness graceful degradation for time-varying products
124pub mod static_positioning; // multi-epoch static position fusion
125mod static_reference_station; // RINEX reference-station static solve
126mod tropo; // Saastamoinen zenith + Niell (NMF) mapping troposphere
127pub mod velocity; // receiver velocity / clock-drift least-squares solve
128
129mod error;
130pub mod frame;
131pub mod frame_catalog;
132mod id;
133
134pub mod atmosphere;
135pub mod combinations;
136pub mod dgnss;
137pub mod ephemeris;
138pub mod estimation; // Phase-2 estimation substrate: named operation-order recipes
139pub mod geodesic; // WGS84 geodesic direct and inverse solvers
140pub mod geodetic_time_series; // robust station velocity, trajectory, steps, and fields
141pub mod geofence; // geodesic geofence containment and uncertainty gates
142pub mod geoid; // geoid undulation grid + bilinear interpolation (orthometric heights)
143pub mod geometry;
144pub mod geometry_quality;
145pub mod ils; // integer least squares ambiguity-resolution kernels
146pub mod inertial; // ECEF strapdown INS frames, mechanization, and IMU error model
147pub mod integrity; // shared protection and covariance primitives
148pub mod observation_qc; // RINEX observation completeness and signal rollups
149pub mod qc_obs {
150    //! RINEX observation quality-control rollups.
151    pub use crate::observation_qc::*;
152}
153pub mod orbit;
154pub mod orbit_determination;
155pub mod positioning;
156pub mod prelude;
157pub mod quality; // measurement weighting, RAIM, and FDE integrity checks
158pub mod rinex;
159pub mod rtk_filter; // sequential RTK baseline filter - serializable state ABI (kernel migration)
160pub mod terrain;
161pub mod terrain_store;
162pub mod tides;
163pub mod tolerances;
164
165pub mod fusion; // GNSS/INS error-state prediction and EKF correction over the inertial surface
166
167pub use crate::astro::frames::{
168    EarthOrientation, EarthOrientationProvider, PolarMotionSample,
169    PolarMotionSeriesEarthOrientationProvider, TdbEarthOrientationProvider,
170};
171pub use crate::error_metrics::{
172    error_ellipse_from_enu_m2, horizontal_radius_at, metrics_from_ecef_covariance_m2,
173    metrics_from_enu_covariance_m2, metrics_from_kinematic_solution,
174    metrics_from_position_covariance, spherical_radius_at, vertical_radius_at, ErrorEllipse,
175    ErrorMetricsError, PercentileRadius, PositionErrorMetrics,
176};
177pub use crate::estimation::{
178    alpha_beta_apply_measurement, alpha_beta_filter_step, alpha_beta_predict,
179    alpha_beta_steady_state_gains, cfar_ca_false_alarm_probability, cfar_ca_multiplier_from_pfa,
180    cfar_ca_pfa_from_multiplier, cfar_ca_threshold, ewma_update, ewma_update_power_of_two,
181    kalman_cv_steady_state_gains, mad_spread, nis_expected_value, nis_gate_test,
182    nis_gate_threshold, nis_statistic, normalized_innovation, rts_smooth, smooth_track_rts,
183    AlphaBetaGains, AlphaBetaState, AlphaBetaStep, PrimitiveError, ScalarKalmanGains,
184    SmoothedTrack, SmoothedTrackEpoch, TrackCoordinateFrame, TrackError, TrackFilter,
185    TrackFilterConfig, TrackGatedUpdate, TrackInnovation, TrackPrediction, TrackRtsEpoch,
186    TrackRtsHistory, TrackRtsHistoryBuilder, TrackState, TrackUpdate, MAD_GAUSSIAN_CONSISTENCY,
187};
188pub use crate::quality::{
189    reliability_araim, reliability_design, wtest_noncentrality, wtest_noncentrality_components,
190    ObservationReliability, RangeReliabilityRow, ReliabilityOptions, ReliabilityReport,
191    ReliabilitySummary, WtestNoncentralityComponents,
192};
193pub use araim::ProtectionModel;
194pub use error::{Error, Result};
195pub use frame::{
196    geodetic_to_itrf, itrf_to_geodetic, FrameValueError, ItrfPositionM, ItrfVelocityMS,
197    Wgs84Geodetic,
198};
199pub use frame_catalog::{
200    catalog, catalog_entry, propagate_position, transform, transform_from_epoch, FrameCatalogError,
201    HelmertParameters, HelmertRates, HelmertTransform, TerrestrialFrame, TerrestrialPositionM,
202    TerrestrialState, TerrestrialVelocityMPerYear, TERRESTRIAL_FRAME_CATALOG,
203};
204pub use fusion::{
205    loose_coupling_correction, smooth_fusion_rts, ukf_correct_closed_loop,
206    validate_time_sync_gnss_order, validate_time_sync_imu_order, velocity_match_outage,
207    velocity_match_outage_to_state, F64Bits, FusionFilterKind, FusionRtsEpoch, FusionRtsHistory,
208    FusionRtsHistoryBuilder, FusionStateCodecError, FusionUpdate, GnssFixMeasurement,
209    GnssFixStatus, GnssFixStatusWeighting, IggIiiMeasurementReweighting, InertialFilter,
210    InertialFilterConfig, LooseCouplingConfig, NonHolonomicConstraintConfig,
211    SerializableErrorStateLayout, SerializableFusionSnapshot, SerializableFusionState,
212    SerializableGnssFixStatus, SerializableImuSample, SerializableImuSampleKind,
213    SerializableInsFilterState, SerializableLooseMeasurement, SerializableNavState,
214    SerializableRateEndpoint, SerializableSatelliteId, SerializableStationarityDetectorSample,
215    SerializableStoredCheckpoint, SerializableStoredGnssMeasurement, SerializableStoredImuSample,
216    SerializableTightCarrierPhaseObservation, SerializableTightFilterState,
217    SerializableTightGnssEpoch, SerializableTightGnssObservation,
218    SerializableTightRangeRateObservation, SerializableTimeSyncHistory,
219    SerializableTimeSyncHistoryConfig, SmoothedFusionEpoch, SmoothedFusionTrajectory,
220    StationarityDetectorSnapshotSample, StationaryDetectorConfig, StationaryUpdateConfig,
221    TimeSyncHistoryConfig, TimeSyncHistoryStatus, TimeSyncUpdate, UkfUpdateOptions,
222    UnscentedTransformOptions, VelocityMatchState, VelocityMatchedTrajectory,
223    VelocityMatchingConfig, YangPredictionAdaptiveFactor, DEFAULT_TIME_SYNC_CHECKPOINT_CAPACITY,
224    DEFAULT_TIME_SYNC_IMU_CAPACITY, FUSION_STATE_CODEC_VERSION,
225};
226pub use geodesic::{geodesic_direct, geodesic_inverse, GeodesicError};
227pub use geofence::{
228    containment, containment_probability, containment_probability_with_options, crossing,
229    crossing_probability, crossing_probability_with_options, distance_to_boundary, CrossingEvent,
230    CrossingKind, Fence, GeofenceError, GeofencePositionEstimate, PositionUncertainty,
231    ProbabilityHysteresis, ProbabilityMethod, ProbabilityOptions, GEOFENCE_BOUNDARY_TOLERANCE_M,
232    PLANAR_FAST_PATH_MAX_RADIUS_M,
233};
234pub use geoid::{
235    egm96_undulations_deg, egm96_undulations_rad, ellipsoidal_height_m, geoid_undulation,
236    geoid_undulations_deg, geoid_undulations_rad, orthometric_height_m, Egm2008GridSpacing,
237    Egm2008RasterWindow, GeoidError, GeoidGrid, ProjVgridshiftArithmetic, ProjVgridshiftError,
238};
239pub use id::{GnssSatelliteId, GnssSystem, SatelliteIdError};
240pub use inertial::{
241    gauss_markov_bias_decay, gauss_markov_bias_variance_increment, gravity_ecef_mps2,
242    mechanize_ecef, normal_gravity_mps2, rodrigues_delta_dcm, simulate_imu_samples,
243    simulate_imu_samples_from_increments, true_imu_increment_between, AttitudeQuaternion,
244    ConingCorrection, CorrectedImuIncrement, ImuBias, ImuCalibration, ImuErrorModel, ImuGrade,
245    ImuRateRandomWalk, ImuSample, ImuSampleKind, ImuSimulationOptions, ImuSimulationOutput,
246    ImuSimulator, ImuSpec, InertialError, MechanizationConfig, NavState, SimulatedImuSequence,
247    StrapdownMechanizer, DEFAULT_IMU_SIM_SEED, WGS84_NORMAL_GRAVITY_EQUATOR_MPS2,
248    WGS84_NORMAL_GRAVITY_POLE_MPS2, WGS84_SOMIGLIANA_K,
249};
250pub use observables::{
251    emission_media_batch_at_j2000_s, observable_media_corrections, predict_batch_with_media,
252    predict_batch_with_media_parallel, predict_ranges_with_media, predict_with_media,
253    AppliedMediaCorrections, EmissionMediaBatch, EmissionMediaBatchOptions, EmissionMediaStatus,
254    MediaPredictOptions, MediaPredictedObservables, MediaRangePrediction,
255    ObservableIonosphereCorrection, ObservableMediaOptions, ObservableTroposphereCorrection,
256};
257pub use positioning::{RejectedSat, RejectionReason};
258pub use sbas_pl::{
259    sbas_protection_levels, AirborneModel, DegradationParams, ProtectionGeometry, ProtectionRow,
260    SbasErrorModel, SbasKMultipliers, SbasPlError, SbasProtection, SbasSisError,
261};
262pub use sidereal::{
263    orbit_repeat_lag, periodicity_strength, periodicity_strength_with_sample_interval,
264    repeat_period, sidereal_filter, solar_day_period, SiderealFilterError, SiderealFilterOptions,
265    SiderealFilterOutput, SiderealTemplateMethod, SIDEREAL_DAY_NANOS, SIDEREAL_DAY_SECONDS,
266};