diff options
author | Anton Babushkin <anton.babushkin@me.com> | 2014-01-29 22:11:38 +0100 |
---|---|---|
committer | Anton Babushkin <anton.babushkin@me.com> | 2014-01-29 22:11:38 +0100 |
commit | 7d2f2523f86b4622815a323969a77b245a4ceaa3 (patch) | |
tree | e554dd9980d56cfd9db5255191e3abcd650a5fce /src/modules/navigator/navigator_main.cpp | |
parent | 6f559b279e3d03dbf28eff436b41f3b022c5fa82 (diff) | |
download | px4-firmware-7d2f2523f86b4622815a323969a77b245a4ceaa3.tar.gz px4-firmware-7d2f2523f86b4622815a323969a77b245a4ceaa3.tar.bz2 px4-firmware-7d2f2523f86b4622815a323969a77b245a4ceaa3.zip |
navigator: reset mission item timer on state and mission item changes
Diffstat (limited to 'src/modules/navigator/navigator_main.cpp')
-rw-r--r-- | src/modules/navigator/navigator_main.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/modules/navigator/navigator_main.cpp b/src/modules/navigator/navigator_main.cpp index 061baf0c5..e961a8f94 100644 --- a/src/modules/navigator/navigator_main.cpp +++ b/src/modules/navigator/navigator_main.cpp @@ -865,6 +865,9 @@ Navigator::task_main() if (myState != prevState) { mavlink_log_info(_mavlink_fd, "[navigator] nav state: %s", nav_states_str[myState]); prevState = myState; + + /* reset time counter on state changes */ + _time_first_inside_orbit = 0; } perf_end(_loop_perf); @@ -1112,6 +1115,9 @@ Navigator::set_mission_item() ret = _mission.get_current_mission_item(&_mission_item, &onboard, &index); if (ret == OK) { + /* reset time counter for new item */ + _time_first_inside_orbit = 0; + _mission_item_valid = true; position_setpoint_from_mission_item(&_pos_sp_triplet.current, &_mission_item); @@ -1290,6 +1296,9 @@ Navigator::start_land_home() void Navigator::set_rtl_item() { + /*reset time counter for new RTL item */ + _time_first_inside_orbit = 0; + switch (_rtl_state) { case RTL_STATE_CLIMB: { memcpy(&_pos_sp_triplet.previous, &_pos_sp_triplet.current, sizeof(position_setpoint_s)); |