Files
PX4-Autopilot/msg/GeofenceStatus.msg
Julian Oes 75cb93a7e7 fix(navigator): report a failed geofence load instead of leaving a fragment (#28603)
* fix(navigator): report a failed geofence load instead of leaving a fragment

_updateFence() resets _num_polygons and rebuilds the fence from dataman one
polygon at a time. It can stop early two ways: loadWait() failing for an entry,
or the array resize failing to allocate. Both logged to the console and left
whatever had been loaded so far in place.

A fragment of a fence is worse than no fence. Missing inclusion polygons permit
positions the fence excluded, missing exclusion polygons open up areas it
protected, and unlike an empty fence it still looks to the operator like a fence
is loaded.

Drop what was loaded on either failure and report it with mavlink_log_critical
and an event, so the state is unambiguous and the operator is told the fence is
not active rather than finding out in flight.

Reported by @lihnucs, who found the allocation path.

Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Julian Oes <julian@oes.ch>

* rework(navigator): use _clearFence in ~Geofence()

* refactor(navigator): move new functions in hpp

* fix(navigator): pub GF_STATUS_FAILED when _updateFence fails and ensure GF is reloaded if previously failed with new request with same opaque id

* refactor(navigator): remove redundant check

* feat(msg): add GF_STATUS_FAILED to GeofenceStatus.msg

* refactor(navigator): rename _fence_updated to _fence_loaded

The flag now means the requested fence was loaded successfully, and
"updated" reads like a uORB or dataman change. Default it to false
since nothing is loaded at boot.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Julian Oes <julian@oes.ch>

---------

Signed-off-by: Julian Oes <julian@oes.ch>
Co-authored-by: jonas <jonas.perolini@rigi.tech>
2026-09-17 10:04:40 +12:00

9 lines
250 B
Plaintext

uint64 timestamp # time since system start (microseconds)
uint32 geofence_id # loaded geofence id
uint8 status # Current geofence status
uint8 GF_STATUS_LOADING = 0
uint8 GF_STATUS_READY = 1
uint8 GF_STATUS_FAILED = 2