Exemplo n.º 1
0
    class KBRL_RRT(Planner):
        def __init__(self,
                     robot,
                     environment,
                     sampler=None,
                     dist_to_goal=1.0,
                     max_iterations=5000,
                     bias=1.0,
                     psi=None,
                     screenshot_rate=1,
                     save_screenshots=False):

            heuristic = lambda s, t: robot.get_dist(s, t)
            env = environment
            if sampler is None:
                sampler = UniformSampler(environment.config_range)
            if psi is None:
                psi = RBF_Kernel(np.ones(len(environment.config_range)) * 1.0)

            self.dist_to_goal = dist_to_goal
            self.rl_planner = RL_planner(env, heuristic, sampler, bias, psi)
            self.robot = robot
            self.max_iterations = max_iterations
            self.screenshot_rate = screenshot_rate
            self.save_screenshots = save_screenshots

        def __call__(self, start, goal):
            start = np.array(start)
            goal = np.array(goal)

            goal_test = lambda x: self.robot.get_dist(x, goal
                                                      ) < self.dist_to_goal
            path, data = self.rl_planner.plan(
                start,
                goal,
                goal_test,
                screenshot_rate=self.screenshot_rate,
                save_screenshot=self.save_screenshots,
                max_iterations=self.max_iterations)
            data['robot'] = self.robot
            return path, data
Exemplo n.º 2
0
 class KBRL_RRT(Planner):
     def __init__(self,
                  robot,
                  environment,
                  sampler = None,
                  dist_to_goal = 1.0,
                  max_iterations=5000,
                  bias = 1.0,
                  psi = None,
                  screenshot_rate = 1,
                  save_screenshots = False):
         
         heuristic = lambda s, t: robot.get_dist(s, t)
         env = environment
         if sampler is None:
             sampler = UniformSampler(environment.config_range)
         if psi is None:
             psi = RBF_Kernel(np.ones(len(environment.config_range))*1.0)
             
         self.dist_to_goal = dist_to_goal
         self.rl_planner = RL_planner(env, heuristic, sampler, bias, psi)
         self.robot = robot
         self.max_iterations = max_iterations
         self.screenshot_rate = screenshot_rate
         self.save_screenshots = save_screenshots
         
     def __call__(self, start, goal):
         start = np.array(start)
         goal = np.array(goal)
         
         goal_test = lambda x: self.robot.get_dist(x, goal) < self.dist_to_goal
         path, data = self.rl_planner.plan(start, 
                                           goal, 
                                           goal_test,
                                           screenshot_rate = self.screenshot_rate,
                                           save_screenshot = self.save_screenshots, 
                                           max_iterations = self.max_iterations)
         data['robot'] = self.robot
         return path, data
Exemplo n.º 3
0
 def __init__(self,
              robot,
              environment,
              sampler = None,
              dist_to_goal = 1.0,
              max_iterations=5000,
              bias = 1.0,
              psi = None,
              screenshot_rate = 1,
              save_screenshots = False):
     
     heuristic = lambda s, t: robot.get_dist(s, t)
     env = environment
     if sampler is None:
         sampler = UniformSampler(environment.config_range)
     if psi is None:
         psi = RBF_Kernel(np.ones(len(environment.config_range))*1.0)
         
     self.dist_to_goal = dist_to_goal
     self.rl_planner = RL_planner(env, heuristic, sampler, bias, psi)
     self.robot = robot
     self.max_iterations = max_iterations
     self.screenshot_rate = screenshot_rate
     self.save_screenshots = save_screenshots
Exemplo n.º 4
0
        def __init__(self,
                     robot,
                     environment,
                     sampler=None,
                     dist_to_goal=1.0,
                     max_iterations=5000,
                     bias=1.0,
                     psi=None,
                     screenshot_rate=1,
                     save_screenshots=False):

            heuristic = lambda s, t: robot.get_dist(s, t)
            env = environment
            if sampler is None:
                sampler = UniformSampler(environment.config_range)
            if psi is None:
                psi = RBF_Kernel(np.ones(len(environment.config_range)) * 1.0)

            self.dist_to_goal = dist_to_goal
            self.rl_planner = RL_planner(env, heuristic, sampler, bias, psi)
            self.robot = robot
            self.max_iterations = max_iterations
            self.screenshot_rate = screenshot_rate
            self.save_screenshots = save_screenshots