예제 #1
0
import pyglet
from pyplan.environment import parse_world, SampledExpansionEnvironment
from pyplan.geometry import Polygon, Collection
from pyplan.robot import Point_Robot
from pyplan.renderer import Renderer, KBRLRRT_draw, Enviornment_draw, set_projection
from pyplan.renderer import get_mouse_coord
from pyplan.planner import KBRL_RRT
from pyglet.window import key
import numpy as np

filepath = 'testworld.xml'
robot = Point_Robot()
start, goal, pos_range, polys = parse_world(filepath)
envi = SampledExpansionEnvironment(Collection([Polygon(p) for p in polys]),
                                   robot, pos_range)

planner = KBRL_RRT(robot=robot,
                   environment=envi,
                   dist_to_goal=0.5,
                   max_iterations=200,
                   bias=1,
                   psi=None,
                   screenshot_rate=20,
                   save_screenshots=True)

path, rrt_data = planner(start, goal)
index_range = [0, len(rrt_data['screenshots']) - 1]
index = len(rrt_data['screenshots']) - 1

configTemp = pyglet.gl.Config(sample_buffers=1,
                              samples=4,
예제 #2
0
        if not os.path.exists(world_filename):
            input_error = True
            print error_msg.format(world_filename)

        if os.path.exists(out_filename) and not args.f:
            input_error = True
            print overwrite_error_msg.format( out_filename)

        robot = None
        execfile(robot_filename)
        if robot == None:
            input_error = True
            print code_error_msg.format(*(['robot']*3))

        start, goal, pos_range, poly = parse_world(world_filename)
        enivornment = Environment(Collection([Polygon(p) for p in poly]), robot, pos_range)

        planner = None
        execfile(planner_filename)
        if planner == None:
            input_error = True
            print code_error_msg.format(*(['planner']*3))

        if input_error:
            sys.exit(1)

        print 'Running planner...'
        path, data = planner(start, goal)
        with open(out_filename, 'wb') as f:
            pickle.dump(data, f)
예제 #3
0
import pyglet
from pyplan.environment import parse_world, SampledExpansionEnvironment
from pyplan.geometry import Polygon, Collection
from pyplan.robot import Point_Robot
from pyplan.renderer import Renderer, KBRLRRT_draw, Enviornment_draw, set_projection
from pyplan.renderer import get_mouse_coord
from pyplan.planner import KBRL_RRT
from pyglet.window import key
import numpy as np

filepath = 'testworld.xml'
robot = Point_Robot()
start, goal, pos_range, polys = parse_world(filepath)
envi = SampledExpansionEnvironment(Collection([Polygon(p) for p in polys]), robot, pos_range)

planner = KBRL_RRT(robot = robot, 
                   environment = envi, 
                   dist_to_goal = 0.5, 
                   max_iterations = 200, 
                   bias = 1, 
                   psi = None, 
                   screenshot_rate = 20, 
                   save_screenshots = True)

path, rrt_data = planner(start, goal)
index_range = [0, len(rrt_data['screenshots'])-1]
index = len(rrt_data['screenshots'])-1

configTemp = pyglet.gl.Config(sample_buffers=1,
    samples=4,
    double_buffer=True,
예제 #4
0
        if not os.path.exists(world_filename):
            input_error = True
            print error_msg.format(world_filename)

        if os.path.exists(out_filename) and not args.f:
            input_error = True
            print overwrite_error_msg.format(out_filename)

        robot = None
        execfile(robot_filename)
        if robot == None:
            input_error = True
            print code_error_msg.format(*(["robot"] * 3))

        start, goal, pos_range, poly = parse_world(world_filename)
        enivornment = Environment(Collection([Polygon(p) for p in poly]), robot, pos_range)

        planner = None
        execfile(planner_filename)
        if planner == None:
            input_error = True
            print code_error_msg.format(*(["planner"] * 3))

        if input_error:
            sys.exit(1)

        print "Running planner..."
        path, data = planner(start, goal)
        with open(out_filename, "wb") as f:
            pickle.dump(data, f)