diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-07 14:30:38 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-07 14:30:38 +0200 |
commit | be73ad0bdb932e35cf891e8f5ffc1b89fdd683dc (patch) | |
tree | a56ff050d1de9264e464cd511f1a2a06b20c511b /src/modules/navigator/navigator_main.cpp | |
parent | 77ca6fa8a3d3990bf75a02da70b25c7a0c6ae91e (diff) | |
parent | 06f08ad04d4cb21047944f350e4a75e88914e1e1 (diff) | |
download | px4-firmware-be73ad0bdb932e35cf891e8f5ffc1b89fdd683dc.tar.gz px4-firmware-be73ad0bdb932e35cf891e8f5ffc1b89fdd683dc.tar.bz2 px4-firmware-be73ad0bdb932e35cf891e8f5ffc1b89fdd683dc.zip |
Merge pull request #1119 from PX4/navigator_rewrite_drton
Navigator rewrite - DrTon
Diffstat (limited to 'src/modules/navigator/navigator_main.cpp')
-rw-r--r-- | src/modules/navigator/navigator_main.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/modules/navigator/navigator_main.cpp b/src/modules/navigator/navigator_main.cpp index 546602741..bb48db829 100644 --- a/src/modules/navigator/navigator_main.cpp +++ b/src/modules/navigator/navigator_main.cpp @@ -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,24 +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++) { - 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); |