mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 14:13:34 +08:00
geofence: lock geofence items during a write transfers
- avoids race conditions when geofence data is updated in flight. During a transfer, the geofence module will not check for violations, which is done with the new dm_trylock method. - there is an update counter stored in dataman, and for each write transaction this is increased, so that the geofence module can reload the data upon data change (after it's unlocked). - single dm item updates are atomic already, so resetting the polygons to 0 does not need locking.
This commit is contained in:
@@ -78,7 +78,8 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* update the geofence from dataman
|
||||
* update the geofence from dataman.
|
||||
* It's generally not necessary to call this as it will automatically update when the data is changed.
|
||||
*/
|
||||
void updateFence();
|
||||
|
||||
@@ -167,6 +168,12 @@ private:
|
||||
control::BlockParamFloat _param_max_ver_distance;
|
||||
|
||||
int _outside_counter{0};
|
||||
uint16_t _update_counter{0}; ///< dataman update counter: if it does not match, we polygon data was updated
|
||||
|
||||
/**
|
||||
* implementation of updateFence(), but without locking
|
||||
*/
|
||||
void _updateFence();
|
||||
|
||||
/**
|
||||
* Check if a point passes the Geofence test.
|
||||
|
||||
Reference in New Issue
Block a user