Skip to main content
GNSS Documentation
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Navigation

Reading position, velocity, and time data from the GNSS receiver.

Blocking vs Polling

Method Behavior Use Case
waitAndGetFreshNavigation() Blocks until a new measurement arrives Main loop — process each update exactly once
navigation() Returns the last known data immediately Quick check, UI update, non-critical read
// Blocking — waits for next measurement
auto nav = hat->waitAndGetFreshNavigation();

// Polling — returns immediately
auto nav = hat->navigation();
# Blocking — releases GIL while waiting
nav = hat.wait_and_get_fresh_navigation()

# Polling — returns immediately
nav = hat.get_navigation()
jp_gnss_navigation_t nav;

// Blocking
jp_gnss_hat_wait_and_get_fresh_navigation(hat, &nav);

// Polling
jp_gnss_hat_get_navigation(hat, &nav);

Thread Safety

All navigation data access is mutex-protected. Multiple threads can call navigation() or waitAndGetFreshNavigation() concurrently without data races.

The blocking call uses a condition variable — the calling thread sleeps (no busy wait) until the background parser signals new data.

Note
Python GIL — The Python bindings release the GIL during blocking calls (wait_and_get_fresh_navigation(), timepulse(), join_forward_for_gpsd(), wait_and_get_fresh_time_mark()). Other Python threads can run while waiting.

Data Flow

GNSS Module → SPI/UART → Background Thread → UBX Parser → Navigation Struct → Your Thread

On SPI HATs (L1, RTK), data arrives via GPIO interrupt (TxReady on GPIO 17). On the UART HAT (TIME), data arrives via epoll. In both cases, there is no polling — the library is fully event-driven.

Each Navigation update contains:

  • PVT — position, velocity, time, fix quality, accuracy estimates
  • DOP — dilution of precision values
  • Satellites — per-satellite signal info (up to 64)
  • RF Blocks — per-band RF/antenna status (up to 2)
  • Geofencing — geofence status (if configured)

See Navigation Data for the complete field reference.