Skip to content

Commit 4bc7048

Browse files
authored
fix: arm_obstacle_navigation calc_heuristic_map node through 4 corners error (AtsushiSakai#1034)
* fix: arm_obstacle_navigation calc_heuristic_map node through 4 corners error * style: remove trailing whitespace
1 parent e5eea35 commit 4bc7048

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

ArmNavigation/arm_obstacle_navigation/arm_obstacle_navigation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ def calc_heuristic_map(M, goal_node):
203203
for i in range(heuristic_map.shape[0]):
204204
for j in range(heuristic_map.shape[1]):
205205
heuristic_map[i, j] = min(heuristic_map[i, j],
206-
i + 1 + heuristic_map[M - 1, j],
207-
M - i + heuristic_map[0, j],
208-
j + 1 + heuristic_map[i, M - 1],
209-
M - j + heuristic_map[i, 0]
206+
M - i - 1 + heuristic_map[M - 1, j],
207+
i + heuristic_map[0, j],
208+
M - j - 1 + heuristic_map[i, M - 1],
209+
j + heuristic_map[i, 0]
210210
)
211211

212212
return heuristic_map

ArmNavigation/arm_obstacle_navigation/arm_obstacle_navigation_2.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def get_occupancy_grid(arm, obstacles):
105105
Args:
106106
arm: An instance of NLinkArm
107107
obstacles: A list of obstacles, with each obstacle defined as a list
108-
of xy coordinates and a radius.
108+
of xy coordinates and a radius.
109109
110110
Returns:
111111
Occupancy grid in joint space
@@ -234,10 +234,10 @@ def calc_heuristic_map(M, goal_node):
234234
for i in range(heuristic_map.shape[0]):
235235
for j in range(heuristic_map.shape[1]):
236236
heuristic_map[i, j] = min(heuristic_map[i, j],
237-
i + 1 + heuristic_map[M - 1, j],
238-
M - i + heuristic_map[0, j],
239-
j + 1 + heuristic_map[i, M - 1],
240-
M - j + heuristic_map[i, 0]
237+
M - i - 1 + heuristic_map[M - 1, j],
238+
i + heuristic_map[0, j],
239+
M - j - 1 + heuristic_map[i, M - 1],
240+
j + heuristic_map[i, 0]
241241
)
242242

243243
return heuristic_map

0 commit comments

Comments
 (0)