Skip to content

Architecture Overview

Orientable-AI-Libgnss is designed for extreme performance and modularity through a layered signal processing architecture.

System Layers

  1. Frontend Layer: Hardware-specific drivers (RTL-SDR, BladeRF, SiGe, etc.) stream raw RF samples into the global IF buffer.
  2. Buffer Management (Lock-Free): Samples are managed in a thread-safe circular buffer. The engine uses atomic counters (_atomic_inc64) to track buffer locations across high-concurrency threads without the overhead of global mutexes.
  3. Physical Layer (PHY): Located in src/core/phy/ and governed by inc/phy/measurement_engine.h.
    • Acquisition: FFT-based search for satellite signals using persistent FFTW plans to eliminate plan creation overhead.
    • Tracking: DLL and PLL loops operating on pre-allocated scratch buffers to achieve a zero-allocation signal path.
    • Code Generation: Real-time generation of gold codes and ranging sequences.
  4. MAC Layer (Navigation): Located in src/core/mac/ and governed by inc/mac/navigation_engine.h.
    • Frame Synchronization: Preamble detection and bit synchronization.
    • Data Decoding: Demodulation of navigation messages (ephemeris, almanac, clock corrections).
    • Error Correction: Integrated FEC and Viterbi decoding.
  5. Observation Engine: Synthesis of raw measurements into pseudo-ranges, carrier phase observations, and SNR metrics.

Zero-Allocation Philosophy

The core processing loop for every satellite channel is strictly zero-allocation. All temporary buffers required for resampling, carrier mixing, and FFT processing are allocated once during channel initialization within the Scratch_t structure. This ensures deterministic real-time performance and prevents heap fragmentation.

Concurrency Model

The library utilizes a hybrid concurrency model: * Asynchronous Hardware I/O: Direct memory access or callback-based streaming from front-end hardware. * Per-Channel Processing Threads: Individual satellites are tracked in independent threads to leverage multi-core processors. * Lock-Free Synchronization: High-frequency state updates (like buffer position) use atomic operations, while lower-frequency control logic uses focused mutex protection.