Skip to content

Commit 06dfc05

Browse files
committed
release grid based_sweep_coverage_path_planner.py
1 parent 6201aa2 commit 06dfc05

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

PathPlanning/ClosedLoopRRTStar/closed_loop_rrt_star_car.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
"""
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.
33
44
author: AtsushiSakai(@Atsushi_twi)
55
66
"""
77

8-
import random
9-
import math
108
import copy
9+
import math
10+
import os
11+
import random
12+
import sys
13+
14+
import matplotlib.pyplot as plt
1115
import numpy as np
16+
1217
import pure_pursuit
13-
import matplotlib.pyplot as plt
1418

15-
import sys
16-
import os
1719
sys.path.append(os.path.dirname(
1820
os.path.abspath(__file__)) + "/../ReedsSheppPath/")
1921

@@ -32,11 +34,11 @@
3234

3335
class RRT():
3436
"""
35-
Class for RRT Planning
37+
Class for RRT planning
3638
"""
3739

3840
def __init__(self, start, goal, obstacleList, randArea,
39-
maxIter=200):
41+
maxIter=50):
4042
"""
4143
Setting Parameter
4244
@@ -77,6 +79,7 @@ def Planning(self, animation=True):
7779
self.try_goal_path()
7880

7981
for i in range(self.maxIter):
82+
print("loop:", i)
8083
rnd = self.get_random_point()
8184
nind = self.GetNearestListIndex(self.nodeList, rnd)
8285

@@ -113,7 +116,7 @@ def search_best_feasible_path(self, path_indexs):
113116

114117
best_time = float("inf")
115118

116-
fx = None
119+
fx, fy, fyaw, fv, ft, fa, fd = None, None, None, None, None, None, None
117120

118121
# pure pursuit tracking
119122
for ind in path_indexs:
@@ -246,7 +249,7 @@ def get_random_point(self):
246249
return node
247250

248251
def get_best_last_indexs(self):
249-
# print("get_best_last_index")
252+
# print("search_finish_node")
250253

251254
YAWTH = np.deg2rad(1.0)
252255
XYTH = 0.5
@@ -387,7 +390,7 @@ def __init__(self, x, y, yaw):
387390
self.parent = None
388391

389392

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):
391394
print("Start" + __file__)
392395
# ====Search Path with RRT====
393396
obstacleList = [

PathPlanning/ClosedLoopRRTStar/pure_pursuit.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
author: Atsushi Sakai
66
77
"""
8-
import numpy as np
98
import math
9+
1010
import matplotlib.pyplot as plt
11+
import numpy as np
12+
1113
import unicycle_model
1214

1315
Kp = 2.0 # speed propotional gain
@@ -75,7 +77,7 @@ def calc_target_index(state, cx, cy):
7577

7678
while Lf > L and (ind + 1) < len(cx):
7779
dx = cx[ind + 1] - cx[ind]
78-
dy = cx[ind + 1] - cx[ind]
80+
dy = cy[ind + 1] - cy[ind]
7981
L += math.sqrt(dx ** 2 + dy ** 2)
8082
ind += 1
8183

@@ -153,6 +155,7 @@ def set_stop_point(target_speed, cx, cy, cyaw):
153155
forward = True
154156

155157
d = []
158+
is_back = False
156159

157160
# Set stop point
158161
for i in range(len(cx) - 1):

0 commit comments

Comments
 (0)