Skip to main content

Crate kinavis_kernel

Crate kinavis_kernel 

Source
Expand description

Value types of the KINAVIS crates.

The kernel holds what has exactly one correct implementation: units, angles, positions, time, the error type. Anything with a choice of method (sailing, interpolation, fix) lives in kinavis; every satellite crate (parsers, magnetic model, INS) depends on the kernel alone. This is the workspace dependency rule: adapters change without touching the core.

Most users should depend on kinavis, which re-exports these modules. Depend on kinavis-kernel directly for an adapter that must not pull in the algorithms.

§Type guarantees

Angles carry their reference frame: CompassCourse, MagneticCourse, TrueCourse, GyroCourse, Variation, Deviation, RelativeBearing. Passing a magnetic course where a true one is expected does not compile. Distance and Speed are types, so knots cannot be passed as m/s.

Each type enforces its range: a Direction is always finite and in [0°, 360°), a Latitude in [-90°, 90°]. Existence implies validity, so corrections built on them return values, not Result. Invalid input is rejected at construction with a KernelError; nothing panics on caller data.

§Modules

  • angle — frame-tagged angles.
  • units — angles, distances, speeds, rate of turn.
  • position — latitude, longitude, notation.
  • error — the error type and validation helpers.
  • time — instants with the time scale in the type, calendar, leap-second port.
  • observation — a value with its time and quality; age is computed.
  • geodesy — ellipsoids, heights with datum, ECEF, chart datums and their transformation to WGS 84.
  • local — NED and other local frames; vectors typed by frame and unit; a frame anchored at a point.
  • gnss — a satellite fix, independent of the sentence format.
  • state — navigation state aggregate behind invariants, projected to the read model.
  • estimation — estimator ports: process model and observation.
  • environment — environment ports (magnetic field, current, wind, tide, leeway, deviation) and the sample they return.
  • snapshot — read model: position, motion, uncertainty and age, for displays and alarms.
  • event — events returned as values in a fixed-capacity list, never via callbacks.
  • matrix — small dense matrices with checked access and Cholesky factorisation.
  • math — floating-point primitives routed to std or libm. Every transcendental call in the crate family goes through here, for reproducibility across targets.
  • inline — fixed-capacity storage; no allocator required.

§Feature flags

  • std (default) — standard library floating-point maths.
  • libm — for no_std targets: --no-default-features --features libm.
  • serde — serialisation of the value types; deserialisation applies the same validation as construction.
  • alloc — unused here; lets dependent crates name one flag for the whole family.

No dependencies in the default configuration.

§Hidden items

Some public items are #[doc(hidden)]: constructors that accept a raw value unchecked (from_degrees_unchecked, from_knots_unchecked, from_degrees_wrapped, relabel) and accessors exposing internal representation (NavigationState vector, covariance and from_parts, the state dimension, Jacobian entries). The algorithm crates need them — a solver wrapping an already-bounded angle should not pay for a check, an estimator must see the covariance — and Rust has no visibility between crates other than pub. They form an internal contract of the crate family: not covered by the stability guarantee, may change in a minor release, and marked as such in their docs. Use them only from crates released together with the kernel.

Re-exports§

pub use angle::wrap180;
pub use angle::wrap360;
pub use angle::CardinalPoint;
pub use angle::Compass;
pub use angle::CompassBearing;
pub use angle::CompassCourse;
pub use angle::Deviation;
pub use angle::Direction;
pub use angle::Frame;
pub use angle::Gyro;
pub use angle::GyroBearing;
pub use angle::GyroCourse;
pub use angle::Magnetic;
pub use angle::MagneticBearing;
pub use angle::MagneticCourse;
pub use angle::RelativeBearing;
pub use angle::Side;
pub use angle::True;
pub use angle::TrueBearing;
pub use angle::TrueCourse;
pub use angle::Variation;
pub use angle::MAX_DEVIATION_DEG;
pub use angle::MAX_VARIATION_DEG;
pub use environment::CompassModel;
pub use environment::Current;
pub use environment::CurrentModel;
pub use environment::EnvironmentSample;
pub use environment::LeewayModel;
pub use environment::MagneticField;
pub use environment::MagneticModel;
pub use environment::TideModel;
pub use environment::VesselMotion;
pub use environment::Wind;
pub use environment::WindModel;
pub use environment::MAX_FIELD_NANOTESLA;
pub use error::Excerpt;
pub use error::KernelError;
pub use error::Result;
pub use error::EXCERPT_BYTES;
pub use estimation::GatingPolicy;
pub use estimation::JacobianRow;
pub use estimation::Observation;
pub use estimation::ObservationJacobian;
pub use estimation::ObservationNoise;
pub use estimation::ObservationVector;
pub use estimation::ProcessModel;
pub use estimation::ProcessNoise;
pub use estimation::StateJacobian;
pub use estimation::MAX_OBSERVATION_DIM;
pub use event::Event;
pub use event::EventList;
pub use event::NavigationEvent;
pub use event::NavigationIntegrity;
pub use event::PositionSource;
pub use event::RejectionReason;
pub use event::SensorHealth;
pub use event::SensorId;
pub use event::TargetId;
pub use event::MAX_EVENTS;
pub use event::SENSOR_NAME_BYTES;
pub use geodesy::Datum;
pub use geodesy::EcefPoint;
pub use geodesy::Ellipsoid;
pub use geodesy::GeodeticPoint;
pub use geodesy::Height;
pub use geodesy::Helmert;
pub use geodesy::VerticalDatum;
pub use gnss::Dop;
pub use gnss::FixType;
pub use gnss::GnssFix;
pub use gnss::GnssFixBuilder;
pub use gnss::GnssQuality;
pub use inline::InlineStr;
pub use local::Body;
pub use local::Enu;
pub use local::LocalFrame;
pub use local::Ned;
pub use local::Vector3;
pub use local::VectorFrame;
pub use local::VectorUnit;
pub use observation::ObservationStatus;
pub use observation::Observed;
pub use observation::Quality;
pub use position::EastWest;
pub use position::GeocentricUnit;
pub use position::Latitude;
pub use position::Longitude;
pub use position::NorthSouth;
pub use position::Position;
pub use snapshot::ErrorEllipse;
pub use snapshot::GroundTrack;
pub use snapshot::NavigationSnapshot;
pub use state::NavigationState;
pub use state::StateComponent;
pub use state::StatePriors;
pub use time::Civil;
pub use time::Gps;
pub use time::Instant;
pub use time::LeapSeconds;
pub use time::Tai;
pub use time::TimeScale;
pub use time::Utc;
pub use units::Angle;
pub use units::Distance;
pub use units::RateOfTurn;
pub use units::Speed;

Modules§

angle
Angles tagged with their reference frame.
environment
Environment ports and the resolved sample.
error
Errors of the value types and numeric kernels.
estimation
Estimator ports: process model and observation.
event
Events returned as values.
geodesy
Earth figure, points with height, Earth-centred Cartesian coordinates.
gnss
Satellite fix, independent of the sentence it arrived in.
inline
Fixed-capacity storage; nothing built on the kernel needs an allocator.
local
Local Cartesian frames and vectors typed by frame and unit.
math
Floating-point primitives routed to std or libm.
matrix
Small dense matrices with checked access, for estimators.
observation
Observed value: time and quality.
position
Geographic position: latitude, longitude, position.
snapshot
Read model of the navigation solution.
state
Navigation state: the estimator’s belief as one aggregate.
time
Navigation time with the time scale in the type.
units
Angles, distances, speeds and rates of turn as types.