Skip to content

Commit 92d21b3

Browse files
authored
Merge pull request AtsushiSakai#190 from AfroDisco/patch-1
Fixed the sampling function from PRM
2 parents f0749b6 + d25d15c commit 92d21b3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

PathPlanning/ProbabilisticRoadMap/probabilistic_road_map.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ def sample_points(sx, sy, gx, gy, rr, ox, oy, obkdtree):
249249
sample_x, sample_y = [], []
250250

251251
while len(sample_x) <= N_SAMPLE:
252-
tx = (random.random() - minx) * (maxx - minx)
253-
ty = (random.random() - miny) * (maxy - miny)
252+
tx = (random.random() * (maxx - minx)) + minx
253+
ty = (random.random() * (maxy - miny)) + miny
254254

255255
index, dist = obkdtree.search(np.array([tx, ty]).reshape(2, 1))
256256

0 commit comments

Comments
 (0)