diff --git a/libraries/AP_Mission/AP_Mission.cpp b/libraries/AP_Mission/AP_Mission.cpp index a1b527a238fca4..79231cbc334bc5 100644 --- a/libraries/AP_Mission/AP_Mission.cpp +++ b/libraries/AP_Mission/AP_Mission.cpp @@ -152,6 +152,12 @@ void AP_Mission::resume() return; } + GCS_SEND_TEXT(MAV_SEVERITY_INFO, "DB-A1: _repeat_dist = %u", _repeat_dist); + GCS_SEND_TEXT(MAV_SEVERITY_INFO, "DB-A2: _wp_index_history[LAST_WP_PASSED] = %u", _wp_index_history[LAST_WP_PASSED]); + // GCS_SEND_TEXT(MAV_SEVERITY_INFO, "DB-A3: _wp_index_history:"); + // for (uint8_t i=0; i 0 && _wp_index_history[LAST_WP_PASSED] != AP_MISSION_CMD_INDEX_NONE) { // if not already in a resume state calculate the position to rewind to @@ -266,7 +272,9 @@ void AP_Mission::reset() _prev_nav_cmd_wp_index = AP_MISSION_CMD_INDEX_NONE; _prev_nav_cmd_id = AP_MISSION_CMD_ID_NONE; init_jump_tracking(); + GCS_SEND_TEXT(MAV_SEVERITY_INFO, "DB-D2: reset:"); reset_wp_history(); + } /// clear - clears out mission @@ -554,6 +562,7 @@ bool AP_Mission::set_current_cmd(uint16_t index) } // mission command has been set, don't track history. + GCS_SEND_TEXT(MAV_SEVERITY_INFO, "DB-D1: set curr cmd:"); reset_wp_history(); // sanity check index and that we have a mission @@ -1963,6 +1972,8 @@ bool AP_Mission::advance_current_nav_cmd(uint16_t starting_index) return false; } + GCS_SEND_TEXT(MAV_SEVERITY_INFO, "DB-B3: next cmd = %u", cmd_index); + // check if navigation or "do" command if (is_nav_cmd(cmd)) { // save previous nav command index @@ -1985,10 +1996,13 @@ bool AP_Mission::advance_current_nav_cmd(uint16_t starting_index) // and prevent history being re-written until vehicle returns to interrupted position if (_repeat_dist > 0 && !_flags.resuming_mission && _nav_cmd.index != AP_MISSION_CMD_INDEX_NONE && !(_nav_cmd.content.location.lat == 0 && _nav_cmd.content.location.lng == 0)) { // update mission history. last index position is always the most recent wp loaded. + // GCS_SEND_TEXT(MAV_SEVERITY_INFO, "DB-B2: WP Hist:"); for (uint8_t i=0; i _repeat_dist distance. // the last read temp_cmd will be the furthest cmd back in the history array so resume to that. rewind_cmd = temp_cmd; + GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Mission: Rewind to max repeat dist (%u m)", _repeat_dist); return true; } @@ -2861,6 +2882,7 @@ bool AP_Mission::calc_rewind_pos(Mission_Command& rewind_cmd) // fetch next destination wp if (!read_cmd_from_storage(_wp_index_history[resume_index+1], temp_cmd)) { // if read from storage failed then don't use rewind + GCS_SEND_TEXT(MAV_SEVERITY_INFO, "DB7: Failed mission read 2"); return false; } @@ -2881,6 +2903,7 @@ bool AP_Mission::calc_rewind_pos(Mission_Command& rewind_cmd) // continues as planned without further intervention. The resume wp is not written to memory so will not perminantely change the mission. // if we got this far then mission rewind position was successfully calculated + GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Mission: Rewind to lat=%.5f lng=%.5f", ((float)rewind_cmd.content.location.lat)*1e-7, ((float)rewind_cmd.content.location.lng)*1e-7); return true; }