Skip to content

Commit

Permalink
'env'
Browse files Browse the repository at this point in the history
  • Loading branch information
391311qy committed Aug 13, 2020
1 parent c743729 commit e704563
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
15 changes: 10 additions & 5 deletions Sampling_based_Planning/rrt_3D/BIT_star3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ def __init__(self, show_ellipse=False):
# denote if the path is found
self.done = False
self.Path = []

# for drawing the ellipse
self.C = np.zeros([3,3])
self.L = np.zeros([3,3])
self.xcenter = np.zeros(3)
self.show_ellipse = show_ellipse

def run(self):
self.V = {self.xstart} # node expanded
Expand All @@ -97,7 +103,7 @@ def run(self):
self.QV = {v for v in self.V}
# setting the radius
if self.done:
self.r = 1 # sometimes the original radius criteria makes the radius too small to improve existing tree
self.r = 2 # sometimes the original radius criteria makes the radius too small to improve existing tree
num_resample += 1
else:
self.r = self.radius(len(self.V) + len(self.Xsamples)) # radius determined with the sample size and dimension of conf space
Expand Down Expand Up @@ -333,6 +339,7 @@ def visualization(self):
ax.plot(start[0:1], start[1:2], start[2:], 'go', markersize=7, markeredgecolor='k')
ax.plot(goal[0:1], goal[1:2], goal[2:], 'ro', markersize=7, markeredgecolor='k')
# adjust the aspect ratio
ax.dist = 5
set_axes_equal(ax)
make_transparent(ax)
#plt.xlabel('s')
Expand All @@ -342,7 +349,5 @@ def visualization(self):


if __name__ == '__main__':
Newprocess = BIT_star()
Newprocess.run()
# Xsamples = Newprocess.Sample(1000, 140)
# print(len(Xsamples))
Newprocess = BIT_star(show_ellipse=False)
Newprocess.run()
Binary file modified Sampling_based_Planning/rrt_3D/__pycache__/env3D.cpython-37.pyc
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion Sampling_based_Planning/rrt_3D/env3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def R_matrix(z_angle,y_angle,x_angle):
def getblocks():
# AABBs
block = [[4.00e+00, 1.20e+01, 0.00e+00, 5.00e+00, 2.00e+01, 5.00e+00],
[5.00e+00, 1.20e+01, 0.00e+00, 1.00e+01, 1.30e+01, 5.00e+00],
[5.5e+00, 1.20e+01, 0.00e+00, 1.00e+01, 1.30e+01, 5.00e+00],
[1.00e+01, 1.20e+01, 0.00e+00, 1.40e+01, 1.30e+01, 5.00e+00],
[1.00e+01, 9.00e+00, 0.00e+00, 2.00e+01, 1.00e+01, 5.00e+00],
[9.00e+00, 6.00e+00, 0.00e+00, 1.00e+01, 1.00e+01, 5.00e+00]]
Expand Down
7 changes: 4 additions & 3 deletions Sampling_based_Planning/rrt_3D/informed_rrt_star3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ def __init__(self, show_ellipse = False):
self.x0, self.xt = tuple(self.env.start), tuple(self.env.goal)
self.Parent = {}
self.Path = []
self.N = 5000 # used for determining how many batches needed
self.N = 10000 # used for determining how many batches needed
self.ind = 0
self.i = 0
# rrt* near and other utils
self.stepsize = 0.5
self.stepsize = 1
self.gamma = 500
self.eta = self.stepsize
self.rgoal = self.stepsize
Expand Down Expand Up @@ -186,7 +186,7 @@ def line(self, x, y):
return getDist(x, y)

def visualization(self):
if self.ind % 100 == 0:
if self.ind % 500 == 0:
V = np.array(self.V)
edges = list(map(list, self.E))
Path = np.array(self.Path)
Expand Down Expand Up @@ -221,6 +221,7 @@ def visualization(self):
ax.plot(start[0:1], start[1:2], start[2:], 'go', markersize=7, markeredgecolor='k')
ax.plot(goal[0:1], goal[1:2], goal[2:], 'ro', markersize=7, markeredgecolor='k')
# adjust the aspect ratio
ax.dist = 5
set_axes_equal(ax)
make_transparent(ax)
#plt.xlabel('s')
Expand Down
1 change: 1 addition & 0 deletions Sampling_based_Planning/rrt_3D/plot_util3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def visualization(initparams):
ax.plot(start[0:1], start[1:2], start[2:], 'go', markersize=7, markeredgecolor='k')
ax.plot(goal[0:1], goal[1:2], goal[2:], 'ro', markersize=7, markeredgecolor='k')
# adjust the aspect ratio
ax.dist = 5
set_axes_equal(ax)
make_transparent(ax)
#plt.xlabel('s')
Expand Down

0 comments on commit e704563

Please sign in to comment.