From 535d787d7e490ef1669cb5022c4ffe3144e54316 Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 5 Oct 2020 18:16:29 -0700 Subject: [PATCH 1/3] Fix max path cycles for case where map has larger Y dimension than X dimension --- nav2_navfn_planner/src/navfn_planner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nav2_navfn_planner/src/navfn_planner.cpp b/nav2_navfn_planner/src/navfn_planner.cpp index 2258b5e19f..0fac7ce2db 100644 --- a/nav2_navfn_planner/src/navfn_planner.cpp +++ b/nav2_navfn_planner/src/navfn_planner.cpp @@ -320,7 +320,7 @@ NavfnPlanner::getPlanFromPotential( planner_->setStart(map_goal); - int path_len = planner_->calcPath(costmap_->getSizeInCellsX() * 4); + int path_len = planner_->calcPath((costmap_->getSizeInCellsX() >= costmap_->getSizeInCellsY()) ? (costmap_->getSizeInCellsX() * 4) : (costmap_->getSizeInCellsY() * 4)); if (path_len == 0) { return false; } From 999b2ceba311cf1d9bd080611d857cb2fc03cd16 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 6 Oct 2020 10:09:45 -0700 Subject: [PATCH 2/3] Improve readability --- nav2_navfn_planner/src/navfn_planner.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nav2_navfn_planner/src/navfn_planner.cpp b/nav2_navfn_planner/src/navfn_planner.cpp index 0fac7ce2db..caf71d0db8 100644 --- a/nav2_navfn_planner/src/navfn_planner.cpp +++ b/nav2_navfn_planner/src/navfn_planner.cpp @@ -320,7 +320,9 @@ NavfnPlanner::getPlanFromPotential( planner_->setStart(map_goal); - int path_len = planner_->calcPath((costmap_->getSizeInCellsX() >= costmap_->getSizeInCellsY()) ? (costmap_->getSizeInCellsX() * 4) : (costmap_->getSizeInCellsY() * 4)); + const int& max_cycles = (costmap_->getSizeInCellsX() >= costmap_->getSizeInCellsY()) ? (costmap_->getSizeInCellsX() * 4) : (costmap_->getSizeInCellsY() * 4); + + int path_len = planner_->calcPath(max_cycles); if (path_len == 0) { return false; } From 932d278ac0d0f4dfab25745a509841f633c01003 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 6 Oct 2020 10:36:14 -0700 Subject: [PATCH 3/3] fix ament_cpplint and ament_uncrustify issues --- nav2_navfn_planner/src/navfn_planner.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nav2_navfn_planner/src/navfn_planner.cpp b/nav2_navfn_planner/src/navfn_planner.cpp index caf71d0db8..1b2e2d5e95 100644 --- a/nav2_navfn_planner/src/navfn_planner.cpp +++ b/nav2_navfn_planner/src/navfn_planner.cpp @@ -320,7 +320,8 @@ NavfnPlanner::getPlanFromPotential( planner_->setStart(map_goal); - const int& max_cycles = (costmap_->getSizeInCellsX() >= costmap_->getSizeInCellsY()) ? (costmap_->getSizeInCellsX() * 4) : (costmap_->getSizeInCellsY() * 4); + const int & max_cycles = (costmap_->getSizeInCellsX() >= costmap_->getSizeInCellsY()) ? + (costmap_->getSizeInCellsX() * 4) : (costmap_->getSizeInCellsY() * 4); int path_len = planner_->calcPath(max_cycles); if (path_len == 0) {