navigator: API changes, reparing to move manual modes to navigator, WIP

This commit is contained in:
Anton Babushkin
2014-06-29 14:09:22 +02:00
parent 12be974bd6
commit 0bf9c2a9b2
10 changed files with 87 additions and 86 deletions
+6 -5
View File
@@ -121,7 +121,7 @@ Navigator::Navigator() :
_mission(this, "MIS"),
_loiter(this, "LOI"),
_rtl(this, "RTL"),
_update_triplet(false),
_pos_sp_triplet_updated(false),
_param_loiter_radius(this, "LOITER_RAD"),
_param_acceptance_radius(this, "ACC_RAD")
{
@@ -371,20 +371,21 @@ Navigator::task_main()
/* iterate through navigation modes and set active/inactive for each */
for(unsigned int i = 0; i < NAVIGATOR_MODE_ARRAY_SIZE; i++) {
_update_triplet = _navigation_mode_array[i]->run(_navigation_mode == _navigation_mode_array[i], &_pos_sp_triplet);
_navigation_mode_array[i]->run(_navigation_mode == _navigation_mode_array[i]);
}
/* if nothing is running, set position setpoint triplet invalid */
if (_navigation_mode == nullptr) {
// TODO publish empty sp only once
_pos_sp_triplet.previous.valid = false;
_pos_sp_triplet.current.valid = false;
_pos_sp_triplet.next.valid = false;
_update_triplet = true;
_pos_sp_triplet_updated = true;
}
if (_update_triplet) {
if (_pos_sp_triplet_updated) {
publish_position_setpoint_triplet();
_update_triplet = false;
_pos_sp_triplet_updated = false;
}
perf_end(_loop_perf);