|
1 | 1 | """ |
2 | | -Path Planning Sample Code with Closed loop RRT for car like robot. |
| 2 | +Path planning Sample Code with Closed loop RRT for car like robot. |
3 | 3 |
|
4 | 4 | author: AtsushiSakai(@Atsushi_twi) |
5 | 5 |
|
6 | 6 | """ |
7 | 7 |
|
8 | | -import random |
9 | | -import math |
10 | 8 | import copy |
| 9 | +import math |
| 10 | +import os |
| 11 | +import random |
| 12 | +import sys |
| 13 | + |
| 14 | +import matplotlib.pyplot as plt |
11 | 15 | import numpy as np |
| 16 | + |
12 | 17 | import pure_pursuit |
13 | | -import matplotlib.pyplot as plt |
14 | 18 |
|
15 | | -import sys |
16 | | -import os |
17 | 19 | sys.path.append(os.path.dirname( |
18 | 20 | os.path.abspath(__file__)) + "/../ReedsSheppPath/") |
19 | 21 |
|
|
32 | 34 |
|
33 | 35 | class RRT(): |
34 | 36 | """ |
35 | | - Class for RRT Planning |
| 37 | + Class for RRT planning |
36 | 38 | """ |
37 | 39 |
|
38 | 40 | def __init__(self, start, goal, obstacleList, randArea, |
39 | | - maxIter=200): |
| 41 | + maxIter=50): |
40 | 42 | """ |
41 | 43 | Setting Parameter |
42 | 44 |
|
@@ -77,6 +79,7 @@ def Planning(self, animation=True): |
77 | 79 | self.try_goal_path() |
78 | 80 |
|
79 | 81 | for i in range(self.maxIter): |
| 82 | + print("loop:", i) |
80 | 83 | rnd = self.get_random_point() |
81 | 84 | nind = self.GetNearestListIndex(self.nodeList, rnd) |
82 | 85 |
|
@@ -113,7 +116,7 @@ def search_best_feasible_path(self, path_indexs): |
113 | 116 |
|
114 | 117 | best_time = float("inf") |
115 | 118 |
|
116 | | - fx = None |
| 119 | + fx, fy, fyaw, fv, ft, fa, fd = None, None, None, None, None, None, None |
117 | 120 |
|
118 | 121 | # pure pursuit tracking |
119 | 122 | for ind in path_indexs: |
@@ -246,7 +249,7 @@ def get_random_point(self): |
246 | 249 | return node |
247 | 250 |
|
248 | 251 | def get_best_last_indexs(self): |
249 | | - # print("get_best_last_index") |
| 252 | + # print("search_finish_node") |
250 | 253 |
|
251 | 254 | YAWTH = np.deg2rad(1.0) |
252 | 255 | XYTH = 0.5 |
@@ -387,7 +390,7 @@ def __init__(self, x, y, yaw): |
387 | 390 | self.parent = None |
388 | 391 |
|
389 | 392 |
|
390 | | -def main(gx=6.0, gy=7.0, gyaw=np.deg2rad(90.0), maxIter=500): |
| 393 | +def main(gx=6.0, gy=7.0, gyaw=np.deg2rad(90.0), maxIter=200): |
391 | 394 | print("Start" + __file__) |
392 | 395 | # ====Search Path with RRT==== |
393 | 396 | obstacleList = [ |
|
0 commit comments