def main(): # ====Search Path with RRT==== # Parameter obstacleList = [ (5, 5, 1), (3, 6, 2), (3, 8, 2), (3, 10, 2), (7, 5, 2), (9, 5, 2) ] # [x,y,size] rrt = RRT(start=[0, 0], goal=[6, 10], rand_area=[-2, 15], obstacle_list=obstacleList) path = rrt.planning(animation=show_animation) # Path smoothing maxIter = 1000 smoothedPath = path_smoothing(path, maxIter, obstacleList) # Draw final path if show_animation: rrt.draw_graph() plt.plot([x for (x, y) in path], [y for (x, y) in path], '-r') plt.plot([x for (x, y) in smoothedPath], [ y for (x, y) in smoothedPath], '-c') plt.grid(True) plt.pause(0.01) # Need for Mac plt.show()
def main(): # ====Search Path with RRT==== # Parameter obstacleList = [(6.23, 1.9, 1.2), (4.48, 3.44, 1.02), (7.51, 7.14, 0.96), (0.59, 8.35, 0.75), (2.19, 7.31, 0.6), (1.43, 2.5, 0.48), (5.8, 6.53, 0.45)] # [x,y,size] rrt = RRT(start=[x_array[start], y_array[start]], goal=[x_array[end], y_array[end]], rand_area=[0, 9], obstacle_list=obstacleList) path = rrt.planning(animation=show_animation) # Path smoothing maxIter = 1000 smoothedPath = path_smoothing(path, maxIter, obstacleList) # Draw final path if show_animation: rrt.draw_graph() plt.plot([x for (x, y) in path], [y for (x, y) in path], '-r') plt.plot([x for (x, y) in smoothedPath], [y for (x, y) in smoothedPath], '-c') plt.grid(True) plt.pause(0.01) # Need for Mac plt.show()