mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 03:31:37 +08:00
navigator: geofence with global pos: reduce update rate
This commit is contained in:
@@ -387,9 +387,13 @@ Navigator::task_main()
|
|||||||
/* global position updated */
|
/* global position updated */
|
||||||
if (fds[0].revents & POLLIN) {
|
if (fds[0].revents & POLLIN) {
|
||||||
global_position_update();
|
global_position_update();
|
||||||
if (_geofence.getSource() == Geofence::GF_SOURCE_GLOBALPOS) {
|
static int gposcounter = 0;
|
||||||
|
if (_geofence.getSource() == Geofence::GF_SOURCE_GLOBALPOS &&
|
||||||
|
gposcounter % 10 == 0) {
|
||||||
|
/* Geofence is checked only every 10th gpos update */
|
||||||
have_geofence_position_data = true;
|
have_geofence_position_data = true;
|
||||||
}
|
}
|
||||||
|
gposcounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check geofence violation */
|
/* Check geofence violation */
|
||||||
|
|||||||
Reference in New Issue
Block a user