Skip to content

Commit a777a3c

Browse files
author
Karan
committed
batch informed trees first commit
1 parent b933c83 commit a777a3c

File tree

1 file changed

+37
-4
lines changed

1 file changed

+37
-4
lines changed

PathPlanning/BatchInformedRRTStar/batch_informed_rrtstar.py

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,63 @@
1414

1515
show_animation = True
1616

17+
class Node():
18+
19+
def __init__(self, x, y):
20+
self.x = x
21+
self.y = y
22+
self.cost = 0.0
23+
self.parent = None
24+
1725
class BITStar():
1826

19-
def __init__(self, star, goal,
27+
def __init__(self, start, goal,
2028
obstacleList, randArea,
21-
expandDis=0.5, goalSampleRate=10, maxIter=200):
29+
expandDis=0.5, goalSampleRate=10, maxIter=200, eta):
30+
self.start = Node(start[0], start[1])
31+
self.goal = Node(goal[0], goal[1])
32+
self.minrand = randArea[0]
33+
self.maxrand = randArea[1]
34+
self.expandDis = expandDis
35+
self.goalSampleRate = goalSampleRate
36+
self.maxIter = maxIter
37+
self.obstacleList = obstacleList
38+
self.samples = dict()
39+
self.g_scores = dict()
40+
self.f_scores = dict()
41+
self.r = float('inf')
42+
self.eta = eta # tunable parameter
43+
self.unit_ball_measure = #TODO
44+
45+
def plan(self, animation=True):
2246

47+
self.nodeList = [self.start]
2348

2449

2550

2651

2752

28-
def plan(self, animation=True):
2953

3054

3155
def expandVertex(self, vertex):
3256

3357
def prune(self, c):
3458

3559
def radius(self, q):
36-
60+
dim = len(start) #dimensions
61+
space_measure = self.minrand * self.maxrand # volume of the space
62+
63+
min_radius = self.eta * 2.0 * pow((1.0 + 1.0/dim) *
64+
(space_measure/self.unit_ball_measure), 1.0/dim)
65+
return min_radius * pow(numpy.log(q)/q, 1/dim)
66+
67+
# Return the closest sample
3768
def getNearestSample(self):
3869

70+
# Sample free space confined in the radius of ball R
3971
def sample(self, m, cMax):
4072

73+
# Sample point in a unit ball
4174
def sampleUnitBall(self, m):
4275

4376
def bestVertexQueueValue(self):

0 commit comments

Comments
 (0)