Libraries/ Navigation/ GPS Sensor Fusion Toolkit
NavigationKalman / EKFNMEA 0183

GPS Sensor Fusion Toolkit

v0.1.0 Unity 2021.3+ No dependencies Paid

The filtering stack that turns noisy, low-rate GPS — and optional AHRS/IMU — into a smooth, high-rate position and heading estimate. Pure C# math core with a zero-allocation hot path.

01Overview

GPS Sensor Fusion is the filtering layer between raw sensors and your gameplay or visualization. It fuses GPS (low rate, position + velocity) with an optional AHRS/IMU (high rate, heading + turn rate) to produce a smooth, high-rate estimate of position, velocity and heading — handling turns correctly and degrading gracefully when GPS drops out. No networking, no third-party packages, and an allocation-free hot path suitable for desktop and mobile.

02Key features

  • Linear Kalman Filter6-state constant-velocity model with quality-adaptive measurement noise.
  • Extended Kalman Filter8-state CTRV model fusing GPS position + velocity with AHRS heading + turn rate. Correct through turns via a proper Jacobian.
  • Adaptive heading filterExponential smoothing with 360° wraparound, rate limiting and a stationary dead-zone that kills compass jitter.
  • CTRV dead reckoningLightweight predictor to interpolate between GPS fixes without the full EKF.
  • NMEA 0183 generator & parserStandard RMC/GGA/GLL/GSA/GSV/VTG from any talker ID. Locale-safe, never throws on malformed input.
  • Geodesy helpersHaversine distance, initial bearing, knots→km/h, and lat/lon → local ENU (Unity meters).
  • Drop-in MonoBehaviourSmooths a Transform from dual-rate input with KF/EKF fusion and GPS-loss handling — inspector-configurable.
  • Pluggable sources + record/replayFeed from raw NMEA, Unity device GPS, or a recorded CSV track. Record & replay with faithful timing — no hardware needed.
  • Zero-allocation math coreIn-place matrix ops, Gauss-Jordan inversion with regularization and condition-number monitoring.
  • Unit testedAn EditMode suite covers matrix math, filter convergence, NMEA I/O, geodesy and record/replay.

03What’s inside

Everything lives under the KephStudio.SensorFusion namespace and compiles into its own assembly.

KalmanFilter6-state linear KF — simple & fast, GPS position/velocity only.
ExtendedKalmanFilter8-state CTRV filter — best quality, ingests AHRS between GPS fixes.
HeadingFilterStandalone adaptive heading smoother (EMA + rate limit + dead-zone).
GPSMovementStateCTRV dead-reckoning predictor for interpolation between fixes.
NMEAGenerator / NmeaParserStandard NMEA 0183 generation and parsing into a GpsFix.
GeoUtilsGeodesy: haversine, bearing, unit conversions, lat/lon → local ENU.
IGpsSource (+ impls)NmeaGpsSource, LocationServiceGpsSource, GpsTrackReplayer.
SfMatrixZero-allocation dense matrix backing the filters.

04Included sample

01

Synthetic Track Demo

Generates a noisy GPS track, runs it through the EKF, and plots truth / noisy / filtered paths with LineRenderers — no GPS hardware required.

05Changelog

v0.1.02026-07-25

Initial extraction into a standalone, dependency-free package.

  • Kalman, Extended Kalman (CTRV), heading and dead-reckoning filters.
  • Standard NMEA 0183 generation & parsing with any talker ID.
  • Pluggable GPS sources: NMEA, Unity LocationService, CSV record & replay.
  • Zero-allocation SfMatrix and an EditMode unit-test suite.