Skip to content

Commit 7ec2f68

Browse files
committed
remove np.matrix
1 parent 895e3ab commit 7ec2f68

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

PathPlanning/VoronoiRoadMap/voronoi_road_map.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ def is_collision(sx, sy, gx, gy, rr, okdtree):
104104
nstep = round(d / D)
105105

106106
for i in range(nstep):
107-
idxs, dist = okdtree.search(np.matrix([x, y]).T)
107+
idxs, dist = okdtree.search(np.array([x, y]).reshape(2, 1))
108108
if dist[0] <= rr:
109109
return True # collision
110110
x += D * math.cos(yaw)
111111
y += D * math.sin(yaw)
112112

113113
# goal point check
114-
idxs, dist = okdtree.search(np.matrix([gx, gy]).T)
114+
idxs, dist = okdtree.search(np.array([gx, gy]).reshape(2, 1))
115115
if dist[0] <= rr:
116116
return True # collision
117117

@@ -135,8 +135,9 @@ def generate_roadmap(sample_x, sample_y, rr, obkdtree):
135135
for (i, ix, iy) in zip(range(nsample), sample_x, sample_y):
136136

137137
index, dists = skdtree.search(
138-
np.matrix([ix, iy]).T, k=nsample)
139-
inds = index[0][0]
138+
np.array([ix, iy]).reshape(2, 1), k=nsample)
139+
140+
inds = index[0]
140141
edge_id = []
141142
# print(index)
142143

0 commit comments

Comments
 (0)