mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 23:31:35 +08:00
Merge branch 'master' into offboard2_merge
Conflicts: src/modules/navigator/navigator.h src/modules/navigator/navigator_main.cpp
This commit is contained in:
@@ -124,7 +124,7 @@ Navigator::Navigator() :
|
||||
_loiter(this, "LOI"),
|
||||
_rtl(this, "RTL"),
|
||||
_offboard(this, "OFF"),
|
||||
_update_triplet(false),
|
||||
_update_triplet_updated(false),
|
||||
_param_loiter_radius(this, "LOITER_RAD"),
|
||||
_param_acceptance_radius(this, "ACC_RAD")
|
||||
{
|
||||
@@ -379,24 +379,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++) {
|
||||
if (_navigation_mode == _navigation_mode_array[i]) {
|
||||
_update_triplet = _navigation_mode_array[i]->on_active(&_pos_sp_triplet);
|
||||
} else {
|
||||
_navigation_mode_array[i]->on_inactive();
|
||||
}
|
||||
_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);
|
||||
|
||||
Reference in New Issue
Block a user