remove np.matrix

This commit is contained in:
Atsushi Sakai
2018-12-14 20:51:24 +09:00
parent 895e3ab40b
commit 7ec2f682bd

View File

@@ -104,14 +104,14 @@ def is_collision(sx, sy, gx, gy, rr, okdtree):
nstep = round(d / D)
for i in range(nstep):
idxs, dist = okdtree.search(np.matrix([x, y]).T)
idxs, dist = okdtree.search(np.array([x, y]).reshape(2, 1))
if dist[0] <= rr:
return True # collision
x += D * math.cos(yaw)
y += D * math.sin(yaw)
# goal point check
idxs, dist = okdtree.search(np.matrix([gx, gy]).T)
idxs, dist = okdtree.search(np.array([gx, gy]).reshape(2, 1))
if dist[0] <= rr:
return True # collision
@@ -135,8 +135,9 @@ def generate_roadmap(sample_x, sample_y, rr, obkdtree):
for (i, ix, iy) in zip(range(nsample), sample_x, sample_y):
index, dists = skdtree.search(
np.matrix([ix, iy]).T, k=nsample)
inds = index[0][0]
np.array([ix, iy]).reshape(2, 1), k=nsample)
inds = index[0]
edge_id = []
# print(index)