mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-01-13 21:08:19 -05:00
remove np.matrix
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user