Merge pull request #19 from swissfang/geofencedataman

Geofence and dataman: lower update rates, lower priority
This commit is contained in:
Julian Oes 2014-09-22 06:35:57 +10:00
commit 6a6bd09973
3 changed files with 10 additions and 2 deletions

View File

@ -1448,8 +1448,12 @@ int commander_thread_main(int argc, char *argv[])
static bool flight_termination_printed = false;
if (!flight_termination_printed) {
warnx("Flight termination because of navigator request or geofence");
mavlink_log_critical(mavlink_fd, "GF violation: flight termination");
flight_termination_printed = true;
}
if (counter % (1000000 / COMMANDER_MONITORING_INTERVAL) == 0 ) {
mavlink_log_critical(mavlink_fd, "GF violation: flight termination");
}
} // no reset is done here on purpose, on geofence violation we want to stay in flighttermination
}

View File

@ -797,7 +797,7 @@ start(void)
sem_init(&g_init_sema, 1, 0);
/* start the worker thread */
if ((task = task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, 2000, task_main, NULL)) <= 0) {
if ((task = task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_DEFAULT, 2000, task_main, NULL)) <= 0) {
warn("task start failed");
return -1;
}

View File

@ -387,9 +387,13 @@ Navigator::task_main()
/* global position updated */
if (fds[0].revents & POLLIN) {
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;
}
gposcounter++;
}
/* Check geofence violation */