def main(): # domain_file = drake_path + "/manipulation_tamp/pddl/throw_domain.pddl" # problem_file = drake_path + "/manipulation_tamp/pddl/throw_problem.pddl" domain_file = drake_path + "/manipulation_tamp/pddl/object_sorting/domain_10obj.pddl" problem_file = drake_path + "/manipulation_tamp/pddl/object_sorting/problem_10obj.pddl" # domain_file = drake_path + "/manipulation_tamp/pddl/object_sorting/domain_7obj.pddl" # problem_file = drake_path + "/manipulation_tamp/pddl/object_sorting/problem_7obj.pddl" # domain_file = drake_path + "/manipulation_tamp/pddl/object_sorting/domain.pddl" # problem_file = drake_path + "/manipulation_tamp/pddl/object_sorting/problem.pddl" problem = _parse(domain_file, problem_file) task = _ground(problem) geo_setup_file = drake_path + "/manipulation_tamp/setup/object_sorting/geo_setup.json" traj_setup_file = drake_path + "/manipulation_tamp/setup/object_sorting/traj_setup.json" # geo_setup_file = drake_path + "/manipulation_tamp/setup/object_sorting_multi_sol/geo_setup.json" # traj_setup_file = drake_path + "/manipulation_tamp/setup/object_sorting_multi_sol/traj_setup.json" motion_planner = MultiWPStaionaryManipMotionPlanRunner( geo_setup_file, traj_setup_file) planner = CausalGraphTampPlanner(task, motion_planner) start = time.time() planner.plan_iterative(option=TRAJ_OPTION) end = time.time() print("Total Planning Time: ", end - start, "sec") filename = "object_sorting_plan" + datetime.now().strftime( "%Y%m%dT%H%M%S") + ".json" planner.save_traj(filename=filename) planner.save_move_query_sequence() print("Branching Factors", planner.branching_factor) print("Tree Size", planner.num_nodes)
def main(): # domain_file = drake_path + "/manipulation_tamp/pddl/conveyor_belt/domain_4obj.pddl" # problem_file = drake_path + "/manipulation_tamp/pddl/conveyor_belt/problem_4obj.pddl" domain_file = drake_path + "/manipulation_tamp/pddl/conveyor_belt/domain_10obj.pddl" problem_file = drake_path + "/manipulation_tamp/pddl/conveyor_belt/problem_10obj.pddl" # domain_file = drake_path + "/manipulation_tamp/pddl/conveyor_belt/obj_cost/domain_3obj.pddl" # problem_file = drake_path + "/manipulation_tamp/pddl/conveyor_belt/obj_cost/problem_3obj.pddl" problem = _parse(domain_file, problem_file) task = _ground(problem) geo_setup_file = drake_path + "/manipulation_tamp/setup/conveyor_belt/geo_setup.json" traj_setup_file = drake_path + "/manipulation_tamp/setup/conveyor_belt/traj_setup.json" # geo_setup_file = drake_path + "/manipulation_tamp/setup/conveyor_belt_obj_cost/geo_setup.json" # traj_setup_file = drake_path + "/manipulation_tamp/setup/conveyor_belt_obj_cost/traj_setup.json" motion_planner = MultiWPConveyorBeltManipMotionPlanRunner( geo_setup_file, traj_setup_file) planner = CausalGraphTampPlanner(task, motion_planner) start = time.time() planner.plan(option=TRAJ_OPTION) end = time.time() print("Total Planning Time: ", end - start, "sec") filename = "conveyor_belt_plan" + datetime.now().strftime( "%Y%m%dT%H%M%S") + ".json" planner.save_traj(filename=filename) planner.save_move_query_sequence() print("Branching Factors", planner.branching_factor) print("Tree Size", planner.num_nodes)
def main(): domain_file = drake_path + "/manipulation_tamp/pddl/conveyor_belt_multi_grasp_mode/domain_coupled.pddl" # domain_file = drake_path + "/manipulation_tamp/pddl/conveyor_belt_multi_grasp_mode/domain_coupled_stationary.pddl" problem_file = drake_path + "/manipulation_tamp/pddl/conveyor_belt_multi_grasp_mode/3obj_coupled.pddl" problem = _parse(domain_file, problem_file) task = _ground(problem) geo_setup_file = drake_path + "/manipulation_tamp/setup/geo_setup_multi_wp.json" traj_setup_file = drake_path + "/manipulation_tamp/setup/traj_setup_multi_wp.json" motion_planner = MultiWPConveyorBeltManipMotionPlanRunner( geo_setup_file, traj_setup_file ) planner = CausalGraphTampPlanner(task, motion_planner) planner.plan(option=TRAJ_OPTION) planner.save_traj()
finisher1-stack-letter sheet1 dummy-sheet """ optimal_plan = [op.strip() for op in optimal_plan.splitlines()] import os from pyperplan import planner from pyperplan.search import breadth_first_search, searchspace from pyperplan.task import Operator, Task benchmarks = os.path.abspath( os.path.join(os.path.abspath(__file__), "../../../../benchmarks")) # Collect problem files problem_file = os.path.join(benchmarks, "parcprinter", "task01.pddl") domain_file = planner.find_domain(problem_file) problem = planner._parse(domain_file, problem_file) task = planner._ground(problem) # Manually do the "search" node = searchspace.make_root_node(task.initial_state) for step, op_name in enumerate(optimal_plan, start=1): for op, successor_state in task.get_successor_states(node.state): if not op.name.strip("()") == op_name: continue node = searchspace.make_child_node(node, op, successor_state) # Check that we reached the goal assert len(task.goals - node.state) == 0
def ground_problem(problem_file): problem = parse_problem(problem_file) print("Grounding", problem.name) task = planner._ground(problem) assert task is not None return task