Skip to content

Commit 00f1816

Browse files
committed
keep coding
1 parent 5b03bc2 commit 00f1816

File tree

3 files changed

+70
-22
lines changed

3 files changed

+70
-22
lines changed

PathPlanning/ClosedLoopRRTStar/closed_loop_rrt_star_car.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
import math
1313
import copy
1414
import numpy as np
15-
import reeds_shepp_path_planning
1615
import pure_pursuit
17-
import unicycle_model
1816
import matplotlib.pyplot as plt
1917

18+
import reeds_shepp_path_planning
19+
import unicycle_model
20+
2021
show_animation = True
2122

2223

@@ -337,18 +338,14 @@ def rewire(self, newNode, nearinds):
337338
self.nodeList[i] = tNode
338339

339340
def DrawGraph(self, rnd=None):
340-
u"""
341+
"""
341342
Draw Graph
342343
"""
343-
# plt.clf()
344344
if rnd is not None:
345345
plt.plot(rnd.x, rnd.y, "^k")
346346
for node in self.nodeList:
347347
if node.parent is not None:
348348
plt.plot(node.path_x, node.path_y, "-g")
349-
pass
350-
# plt.plot([node.x, self.nodeList[node.parent].x], [
351-
# node.y, self.nodeList[node.parent].y], "-g")
352349

353350
for (ox, oy, size) in self.obstacleList:
354351
plt.plot(ox, oy, "ok", ms=30 * size)
@@ -362,9 +359,6 @@ def DrawGraph(self, rnd=None):
362359
plt.grid(True)
363360
plt.pause(0.01)
364361

365-
# plt.show()
366-
# input()
367-
368362
def GetNearestListIndex(self, nodeList, rnd):
369363
dlist = [(node.x - rnd.x) ** 2 +
370364
(node.y - rnd.y) ** 2 +
@@ -399,7 +393,7 @@ def CollisionCheckWithXY(self, x, y, obstacleList):
399393

400394

401395
class Node():
402-
u"""
396+
"""
403397
RRT Node
404398
"""
405399

@@ -417,14 +411,6 @@ def __init__(self, x, y, yaw):
417411
def main():
418412
print("Start rrt start planning")
419413
# ====Search Path with RRT====
420-
obstacleList = [
421-
(5, 5, 1),
422-
(3, 6, 2),
423-
(3, 8, 2),
424-
(3, 10, 2),
425-
(7, 5, 2),
426-
(9, 5, 2)
427-
] # [x,y,size(radius)]
428414
obstacleList = [
429415
(5, 5, 1),
430416
(4, 6, 1),

PathPlanning/ClosedLoopRRTStar/unicycle_model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
#! /usr/bin/python
2-
# -*- coding: utf-8 -*-
31
"""
42
3+
Unicycle model class
54
65
author Atsushi Sakai
6+
77
"""
88

99
import math
1010

1111
dt = 0.05 # [s]
12-
L = 2.9 # [m]
12+
L = 0.9 # [m]
1313
steer_max = math.radians(40.0)
1414
curvature_max = math.tan(steer_max) / L
1515
curvature_max = 1.0 / curvature_max + 1.0

PathPlanning/HybridAStar/hybrid_a_star.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,70 @@
66
77
"""
88

9+
import sys
10+
sys.path.append("../ReedsSheppPath/")
11+
12+
# import random
13+
import math
14+
# import numpy as np
15+
import matplotlib.pyplot as plt
16+
import reeds_shepp_path_planning
17+
18+
show_animation = True
19+
20+
21+
def hybrid_a_star_planning(start, goal, ox, oy, xyreso, yawreso):
22+
23+
rx, ry, ryaw = [], [], []
24+
25+
return rx, ry, ryaw
26+
927

1028
def main():
29+
print("Start rrt start planning")
30+
# ====Search Path with RRT====
31+
32+
ox, oy = [], []
33+
34+
for i in range(60):
35+
ox.append(i)
36+
oy.append(0.0)
37+
for i in range(60):
38+
ox.append(60.0)
39+
oy.append(i)
40+
for i in range(61):
41+
ox.append(i)
42+
oy.append(60.0)
43+
for i in range(61):
44+
ox.append(0.0)
45+
oy.append(i)
46+
for i in range(40):
47+
ox.append(20.0)
48+
oy.append(i)
49+
for i in range(40):
50+
ox.append(40.0)
51+
oy.append(60.0 - i)
52+
53+
# Set Initial parameters
54+
start = [10.0, 10.0, math.radians(90.0)]
55+
goal = [50.0, 50.0, math.radians(-90.0)]
56+
57+
xyreso = 2.0
58+
yawreso = math.radians(15.0)
59+
60+
rx, ry, ryaw = hybrid_a_star_planning(
61+
start, goal, ox, oy, xyreso, yawreso)
62+
63+
plt.plot(ox, oy, ".k")
64+
reeds_shepp_path_planning.plot_arrow(
65+
start[0], start[1], start[2])
66+
reeds_shepp_path_planning.plot_arrow(
67+
goal[0], goal[1], goal[2])
68+
69+
plt.grid(True)
70+
plt.axis("equal")
71+
plt.show()
72+
1173
print(__file__ + " start!!")
1274

1375

0 commit comments

Comments
 (0)