Ejemplo n.º 1
0
    c = rrt.worst_cost
    fname = "rrt_2d_di_%d,%d.png" % (start_time, rrt.n_iters)
    draw(rrt, a.gca())
    a.savefig(fname)
    plt.ion()

    import shelve
    s = shelve.open("rrt_2d_di_%d,%d.shelve" % (start_time, rrt.n_iters))
    upath = rrt.best_solution_goal()[2]
    xpath = lqr_rrt.run_forward(start, upath)
    s['traj'] = xpath
    s['utraj'] = upath
    s.close()


rrt.improved_solution_hook = hook

rrt_int = RRT_Interactive(rrt,
                          lqr_rrt.run_forward,
                          plot_dims=[2, 3],
                          slider_range=(0, max_time_horizon))

obstacles_patches = [PolygonPatch(poly) for poly in obstacles_polys]
obstacle_patch_collection = PatchCollection(obstacles_patches)
rrt_int.int_ax.add_collection(obstacle_patch_collection)

if False and __name__ == '__main__':
    #    if False:
    #        rrt.load(shelve.open('kin_rrt.shelve'))

    i = 0
Ejemplo n.º 2
0
    c = rrt.worst_cost
    fname = "rrt_2d_di_%d,%d.png"%(start_time,rrt.n_iters)
    draw(rrt,a.gca())
    a.savefig(fname)
    plt.ion()

    import shelve
    s = shelve.open("rrt_2d_di_%d,%d.shelve"%(start_time,rrt.n_iters))
    upath = rrt.best_solution_goal()[2]
    xpath = lqr_rrt.run_forward(start,upath)
    s['traj'] = xpath
    s['utraj'] = upath
    s.close()
    
rrt.improved_solution_hook = hook

rrt_int = RRT_Interactive(rrt,lqr_rrt.run_forward,plot_dims=[2,3],slider_range=(0,max_time_horizon))

obstacles_patches = [PolygonPatch(poly) for poly in obstacles_polys]
obstacle_patch_collection = PatchCollection(obstacles_patches)    
rrt_int.int_ax.add_collection(obstacle_patch_collection)

if False and __name__ == '__main__':
#    if False:
#        rrt.load(shelve.open('kin_rrt.shelve'))

    i = 0
    if i>0:
        rrt.load(shelve.open('linship_rrt_%04d.shelve'%(i-1)))