def test6(): obstacles = [Polygon([(2,0), (2, 2), (3, 2), (3, 0)]), Polygon([(4,4), (4,8), (7,1)]), Polygon([(2,2), (1,8), (2,4), (3,3)])] workspace = Workspace(dim=(12,12), obstacles=obstacles) car_rrt = RRT(workspace, (1, 1, pi), (10, 10, pi), 10000, num_rand_actions=4, max_control_time=1, step_threshold=.05) results = car_rrt.build_rrt() print(results) ax = workspace.graph_results(results, car_rrt, plot_tree=False) plt.show()
def test22(): obstacles = [Polygon([(2,0), (8, 0), (8, 1), (2, 1)]), Polygon([(2,10), (8,10), (8,8), (2,8)]), Polygon([(2,1), (2,8), (3,8), (3,1)])] workspace = Workspace(dim=(12,12), obstacles=obstacles) car_rrt = RRT(workspace, (1, 6, pi), (6, 6, pi), 10000, num_rand_actions=6, max_control_time=1, step_threshold=.05) results = car_rrt.build_rrt() print(results) anim = workspace.animate_results(results, car_rrt, plot_tree=True) plt.show()