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

Geofencing

Configure up to 4 circular geofences. The receiver reports per-fence and combined Inside/Outside/Unknown state in every navigation update. Supports PIO pin output for hardware signaling.

Note
HAT Compatibility — Geofencing is available on the L1 GNSS HAT and L1/L5 RTK HAT. Not supported on the TIME HAT.

Reading Geofence Status

auto nav = hat->waitAndGetFreshNavigation();
auto& geo = nav.geofencing;

printf("Combined: %s\n",
    Utils::geofenceStatus2string(geo.nav.combinedState).c_str());

for (int i = 0; i < geo.nav.numberOfGeofences; i++)
{
    printf("Fence %d: %s\n", i,
        Utils::geofenceStatus2string(geo.nav.geofencesStatus[i]).c_str());
}
nav = hat.wait_and_get_fresh_navigation()
geo = nav.geofencing

print(f"Combined: {geo.nav.combined_state}")
for i, status in enumerate(geo.nav.geofences):
    print(f"Fence {i}: {status}")

PIO Pin Output

Polarity Pin LOW Pin HIGH
LowMeansInside Inside any geofence Outside all geofences
LowMeansOutside Outside all geofences Inside any geofence

See Geofencing Config for setup details.