From cf7ae73006181262a0638c0e572420179d2b7624 Mon Sep 17 00:00:00 2001 From: jack ju <1101926054@qq.com> Date: Wed, 15 May 2024 19:08:20 +0800 Subject: [PATCH 1/2] Fix GridPath::getPath function aborted prematurely while backtracking path --- global_planner/src/grid_path.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/global_planner/src/grid_path.cpp b/global_planner/src/grid_path.cpp index 3bf49e4d90..205cfb5eb9 100644 --- a/global_planner/src/grid_path.cpp +++ b/global_planner/src/grid_path.cpp @@ -59,6 +59,8 @@ bool GridPath::getPath(float* potential, double start_x, double start_y, double if (xd == 0 && yd == 0) continue; int x = current.first + xd, y = current.second + yd; + if (x >= xs_ || y >= ys_ || x < 0 || y < 0) + continue; int index = getIndex(x, y); if (potential[index] < min_val) { min_val = potential[index]; From 351f504dab7d12e95cec789f32099bdb6d56cde5 Mon Sep 17 00:00:00 2001 From: jack ju <1101926054@qq.com> Date: Wed, 15 May 2024 19:17:33 +0800 Subject: [PATCH 2/2] Fix GridPath::getPath function aborted prematurely while backtracking path --- global_planner/src/grid_path.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global_planner/src/grid_path.cpp b/global_planner/src/grid_path.cpp index 205cfb5eb9..3b1a2eabcf 100644 --- a/global_planner/src/grid_path.cpp +++ b/global_planner/src/grid_path.cpp @@ -59,7 +59,7 @@ bool GridPath::getPath(float* potential, double start_x, double start_y, double if (xd == 0 && yd == 0) continue; int x = current.first + xd, y = current.second + yd; - if (x >= xs_ || y >= ys_ || x < 0 || y < 0) + if (x > xs_ || y > ys_ || x < 0 || y < 0) continue; int index = getIndex(x, y); if (potential[index] < min_val) {