Skip to content

Commit 596abc4

Browse files
committed
Fixed some typos and added graphing obstacles
1 parent 816c222 commit 596abc4

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

testing/test_hybrid_astar.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ def is_valid_neighbor(self, path):
6767
"""
6868
for obstacle in self.obstacles:
6969
for point in path:
70-
# print(point)
71-
# print(obstacle.polygon())
72-
if collisions.circle_intersects_polygon_2d(point[:-1], 1, obstacle.polygon()):
70+
print(point)
71+
print(obstacle.polygon_parent())
72+
if collisions.circle_intersects_polygon_2d(point[:-1], 1, obstacle.polygon_parent()):
7373
return False
7474

7575
return True
@@ -94,15 +94,15 @@ def plot_path(obstacle, path):
9494
y = [point[1] for point in path]
9595
plt.plot(x,y)
9696

97-
l, w = obstacle.dimensions
97+
l, w, h = obstacle.dimensions
9898
center = [obstacle.pose.x, obstacle.pose.y]
9999

100100
vertices = np.array([
101-
[x - w / 2, y - l / 2], # Bottom-left
102-
[x + w / 2, y - l / 2], # Bottom-right
103-
[x + w / 2, y + l / 2], # Top-right
104-
[x - w / 2, y + l / 2], # Top-left
105-
[x - w / 2, y - l / 2] # Close the polygon
101+
[center[0] - w / 2, center[1] - l / 2], # Bottom-left
102+
[center[0] + w / 2, center[1] - l / 2], # Bottom-right
103+
[center[0] + w / 2, center[1] + l / 2], # Top-right
104+
[center[0] - w / 2, center[1] + l / 2], # Top-left
105+
[center[0] - w / 2, center[1] - l / 2] # Close the polygon
106106
])
107107

108108
# Plot the polygon
@@ -114,8 +114,6 @@ def plot_path(obstacle, path):
114114
plt.grid(True)
115115
plt.show()
116116

117-
plt.show()
118-
119117
if __name__ == '__main__':
120118
solution = solve()
121119
print(solve())

0 commit comments

Comments
 (0)