navigator: only poll for position

We don't need to poll for vehicle commands, we will get them anyway by
doing orb_check. Also, the polling for them wasn't implemented correctly
anyway.
This commit is contained in:
Julian Oes 2016-08-01 10:53:13 +02:00 committed by Beat Küng
parent d80a233bcb
commit f6ad9b8283

View File

@ -325,13 +325,11 @@ Navigator::task_main()
params_update();
/* wakeup source(s) */
px4_pollfd_struct_t fds[2] = {};
px4_pollfd_struct_t fds[1] = {};
/* Setup of loop */
fds[0].fd = _global_pos_sub;
fds[0].events = POLLIN;
fds[1].fd = _vehicle_command_sub;
fds[1].events = POLLIN;
bool global_pos_available_once = false;
@ -353,8 +351,15 @@ Navigator::task_main()
PX4_WARN("nav: poll error %d, %d", pret, errno);
continue;
} else {
/* success, global pos was available */
global_pos_available_once = true;
if (fds[0].revents & POLLIN) {
/* success, global pos is available */
global_position_update();
if (_geofence.getSource() == Geofence::GF_SOURCE_GLOBALPOS) {
have_geofence_position_data = true;
}
global_pos_available_once = true;
}
}
perf_begin(_loop_perf);
@ -491,14 +496,6 @@ Navigator::task_main()
}
}
/* global position updated */
if (fds[0].revents & POLLIN) {
global_position_update();
if (_geofence.getSource() == Geofence::GF_SOURCE_GLOBALPOS) {
have_geofence_position_data = true;
}
}
/* Check geofence violation */
static hrt_abstime last_geofence_check = 0;
if (have_geofence_position_data &&