From a8fd04ddf9d42b4a363f0fad88b7a7a18035ac1e Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Wed, 24 Jul 2019 15:47:47 +0900 Subject: [PATCH] AC_Avoidance: Dijkstra's returns oa-not-required if path has been completed --- libraries/AC_Avoidance/AP_OADijkstra.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/AC_Avoidance/AP_OADijkstra.cpp b/libraries/AC_Avoidance/AP_OADijkstra.cpp index b78a50cc86..cf1fbc9a48 100644 --- a/libraries/AC_Avoidance/AP_OADijkstra.cpp +++ b/libraries/AC_Avoidance/AP_OADijkstra.cpp @@ -88,6 +88,7 @@ AP_OADijkstra::AP_OADijkstra_State AP_OADijkstra::update(const Location ¤t if (!_shortest_path_ok) { _shortest_path_ok = calc_shortest_path(current_loc, destination); if (!_shortest_path_ok) { + AP::logger().Write_OADijkstra(DIJKSTRA_STATE_ERROR, 0, 0, destination, destination); return DIJKSTRA_STATE_ERROR; } // start from 2nd point on path (first is the original origin) @@ -126,9 +127,9 @@ AP_OADijkstra::AP_OADijkstra_State AP_OADijkstra::update(const Location ¤t return DIJKSTRA_STATE_SUCCESS; } - // log failure - AP::logger().Write_OADijkstra(DIJKSTRA_STATE_ERROR, 0, 0, destination, destination); - return DIJKSTRA_STATE_ERROR; + // we have reached the destination so avoidance is no longer required + AP::logger().Write_OADijkstra(DIJKSTRA_STATE_NOT_REQUIRED, 0, 0, destination, destination); + return DIJKSTRA_STATE_NOT_REQUIRED; } // returns true if polygon fence is enabled