| 
4 | 4 | Follows the exact format you wanted using existing infrastructure  | 
5 | 5 | """  | 
6 | 6 | 
 
  | 
7 |  | -import sys  | 
 | 7 | +import logging  | 
8 | 8 | 
 
  | 
9 | 9 | import numpy as np  | 
10 | 10 | import spark_dsg  | 
11 | 11 | from dsg_pddl.pddl_grounding import MultiRobotPddlDomain, PddlGoal  | 
 | 12 | +from utils import DummyRobotPlanningAdaptor, load_omniplanner_pddl_domain  | 
12 | 13 | 
 
  | 
 | 14 | +from omniplanner.compile_plan import collect_plans  | 
13 | 15 | from omniplanner.omniplanner import PlanRequest, full_planning_pipeline  | 
 | 16 | +from omniplanner_ros.pddl_planner_ros import compile_plan  | 
14 | 17 | 
 
  | 
15 |  | -multi_robot_path = (  | 
16 |  | -    "/home/jaeyoun-choi/colcon_ws/src/awesome_dcist_t4/omniplanner/omniplanner/src"  | 
17 |  | -)  | 
18 |  | -if multi_robot_path not in sys.path:  | 
19 |  | -    sys.path.insert(0, multi_robot_path)  | 
 | 18 | +logging.basicConfig(level=logging.DEBUG, force=True)  | 
 | 19 | + | 
 | 20 | + | 
 | 21 | +# multi_robot_path = (  | 
 | 22 | +#    "/home/ubuntu/lxc_datashare/heracles_evaluation_dsg_data/"  | 
 | 23 | +# )  | 
 | 24 | +# if multi_robot_path not in sys.path:  | 
 | 25 | +#    sys.path.insert(0, multi_robot_path)  | 
20 | 26 | 
 
  | 
21 | 27 | 
 
  | 
22 | 28 | def extract_plan_from_wrapper(plan):  | 
@@ -215,77 +221,87 @@ def print_places_in_region(G, region_symbol: str):  | 
215 | 221 |         print(f"  Error listing places for {region_symbol}: {e}")  | 
216 | 222 | 
 
  | 
217 | 223 | 
 
  | 
218 |  | -def main():  | 
219 |  | -    """Main test function following your exact format"""  | 
220 |  | -    print("Multi-Robot Fast Downward Test with Real Scene Graph")  | 
221 |  | -    print("=" * 80)  | 
222 |  | - | 
223 |  | -    # Configuration  | 
224 |  | -    # scene_graph_path = "./src/awesome_dcist_t4/omniplanner/omniplanner/examples/scenegraph/west_point_fused_map_wregions_labelspace.json"  | 
225 |  | -    scene_graph_path = "/home/jaeyoun-choi/colcon_ws/assets/b45_clip_final_connected_rooms_and_labelspace.json"  | 
226 |  | -    # scene_graph_path = "/home/jaeyoun-choi/colcon_ws/assets/west_point_fused_map_wregions_labelspace.json"  | 
227 |  | -    # robot_ids = ["robot1","robot2"]  | 
228 |  | -    robot_ids = ["robot1", "robot2", "robot3"]  | 
229 |  | - | 
230 |  | -    print(f"Scene graph: {scene_graph_path}")  | 
231 |  | -    print(f"Robots: {robot_ids}")  | 
232 |  | - | 
233 |  | -    # Load scene graph  | 
234 |  | -    print(f"Loading scene graph from: {scene_graph_path}")  | 
235 |  | -    G = spark_dsg.DynamicSceneGraph.load(scene_graph_path)  | 
236 |  | -    print(f"✓ Scene graph loaded: {G.num_nodes()} total nodes")  | 
237 |  | - | 
238 |  | -    # Examine scene graph coordinates  | 
239 |  | -    examine_scene_graph_coordinates(G)  | 
240 |  | -    # Print existing region kinds  | 
241 |  | - | 
242 |  | -    print_region_kinds(G)  | 
243 |  | -    # Print region names  | 
244 |  | -    print_region_names(G)  | 
245 |  | -    # Print places included in specific regions of interest  | 
246 |  | -    # print_places_in_region(G, "r68")  | 
247 |  | -    print_places_in_region(G, "r3")  | 
248 |  | -    print_places_in_region(G, "r4")  | 
249 |  | - | 
250 |  | -    # Create robot poses (following your format)  | 
251 |  | -    robot_poses = {  | 
252 |  | -        "robot1": np.array([-15.0, -15.1]),  | 
253 |  | -        "robot2": np.array([-15.0, 0.1]),  | 
254 |  | -        "robot3": np.array([0.0, 6.0]),  | 
255 |  | -    }  | 
256 |  | - | 
257 |  | -    print("=========================================")  | 
258 |  | -    print("==== PDDL region Domain (Multi-Robot) ====")  | 
259 |  | -    print("=========================================")  | 
260 |  | -    print("")  | 
261 |  | - | 
262 |  | -    # goal_string ="(and (safe o2)(safe o3))"  | 
263 |  | -    goal_string = "(and (explored-region r1)(explored-region r2)(visited-object o2)(visited-object o9)(visited-place p22543)(visited-place p6255))"  | 
264 |  | -    goal_string = "(and (in-region robot1 r2) (visited-object o79)(visited-object o285)(visited-object o43)(safe o79)(explored-region r2)(visited-object o2)(visited-object o9)(visited-place p22543)(visited-place p6255))"  | 
265 |  | -    # goal_string ="(and (visited-poi o27))"  | 
266 |  | -    # goal_string ="(and (object-in-place o5 p91) (object-in-place o85 p118) )"  | 
267 |  | -    # goal_string ="(and (object-in-place o5 p91) (object-in-place o94 p2157))"  | 
268 |  | -    # goal_string ="(and (safe o2))"  | 
269 |  | -    # goal_string ="(and (object-in-place o5 p91) (object-in-place o85 p118) (object-in-place o94 p2157))"  | 
270 |  | -    goal = PddlGoal(robot_id="robot1", pddl_goal=goal_string)  | 
271 |  | - | 
272 |  | -    # Load the multi-robot domain  | 
273 |  | -    domain_path = "./src/awesome_dcist_t4/omniplanner/omniplanner/src/dsg_pddl/domains/RegionObjectRearrangementDomain_MultiRobot_FD_Explore.pddl"  | 
274 |  | -    with open(domain_path, "r") as fo:  | 
275 |  | -        domain = MultiRobotPddlDomain(fo.read())  | 
276 |  | - | 
277 |  | -    # print(f"Loading domain {domain_path}")  | 
278 |  | -    # print(f"Domain name: {domain.domain_name}")  | 
279 |  | -    req = PlanRequest(  | 
280 |  | -        domain=domain,  | 
281 |  | -        goal=goal,  | 
282 |  | -        robot_states=robot_poses,  | 
 | 224 | +"""Main test function following your exact format"""  | 
 | 225 | +print("Multi-Robot Fast Downward Test with Real Scene Graph")  | 
 | 226 | +print("=" * 80)  | 
 | 227 | + | 
 | 228 | +# Configuration  | 
 | 229 | +# scene_graph_path = "./src/awesome_dcist_t4/omniplanner/omniplanner/examples/scenegraph/west_point_fused_map_wregions_labelspace.json"  | 
 | 230 | +scene_graph_path = "/home/jaeyoun-choi/colcon_ws/assets/b45_clip_final_connected_rooms_and_labelspace.json"  | 
 | 231 | +# scene_graph_path = "/home/jaeyoun-choi/colcon_ws/assets/west_point_fused_map_wregions_labelspace.json"  | 
 | 232 | +# robot_ids = ["robot1","robot2"]  | 
 | 233 | +robot_ids = ["robot1", "robot2", "robot3"]  | 
 | 234 | + | 
 | 235 | +print(f"Scene graph: {scene_graph_path}")  | 
 | 236 | +print(f"Robots: {robot_ids}")  | 
 | 237 | + | 
 | 238 | +# Load scene graph  | 
 | 239 | +print(f"Loading scene graph from: {scene_graph_path}")  | 
 | 240 | +G = spark_dsg.DynamicSceneGraph.load(scene_graph_path)  | 
 | 241 | +print(f"✓ Scene graph loaded: {G.num_nodes()} total nodes")  | 
 | 242 | + | 
 | 243 | +# Examine scene graph coordinates  | 
 | 244 | +examine_scene_graph_coordinates(G)  | 
 | 245 | +# Print existing region kinds  | 
 | 246 | + | 
 | 247 | +print_region_kinds(G)  | 
 | 248 | +# Print region names  | 
 | 249 | +print_region_names(G)  | 
 | 250 | +# Print places included in specific regions of interest  | 
 | 251 | +# print_places_in_region(G, "r68")  | 
 | 252 | +print_places_in_region(G, "r3")  | 
 | 253 | +print_places_in_region(G, "r4")  | 
 | 254 | + | 
 | 255 | +# Create robot poses (following your format)  | 
 | 256 | +robot_poses = {  | 
 | 257 | +    "ROBOT1": np.array([-15.0, -15.1]),  | 
 | 258 | +    "ROBOT2": np.array([-15.0, 0.1]),  | 
 | 259 | +    "ROBOT3": np.array([0.0, 6.0]),  | 
 | 260 | +}  | 
 | 261 | + | 
 | 262 | +print("=========================================")  | 
 | 263 | +print("==== PDDL region Domain (Multi-Robot) ====")  | 
 | 264 | +print("=========================================")  | 
 | 265 | +print("")  | 
 | 266 | + | 
 | 267 | +# goal_string ="(and (safe o2)(safe o3))"  | 
 | 268 | +goal_string = "(and (explored-region r1)(explored-region r2)(visited-object o2)(visited-object o9)(visited-place p22543)(visited-place p6255))"  | 
 | 269 | +goal_string = "(and (visited-object o79)(visited-object o285)(visited-object o43)(safe o79)(explored-region r2)(visited-object o2)(visited-object o9)(visited-place p22543)(visited-place p6255))"  | 
 | 270 | +# goal_string ="(and (visited-poi o27))"  | 
 | 271 | +# goal_string ="(and (object-in-place o5 p91) (object-in-place o85 p118) )"  | 
 | 272 | +# goal_string ="(and (object-in-place o5 p91) (object-in-place o94 p2157))"  | 
 | 273 | +# goal_string ="(and (safe o2))"  | 
 | 274 | +# goal_string ="(and (object-in-place o5 p91) (object-in-place o85 p118) (object-in-place o94 p2157))"  | 
 | 275 | +goal = PddlGoal(robot_id="robot1", pddl_goal=goal_string)  | 
 | 276 | + | 
 | 277 | +# Load the multi-robot domain  | 
 | 278 | +domain = MultiRobotPddlDomain(  | 
 | 279 | +    load_omniplanner_pddl_domain(  | 
 | 280 | +        "RegionObjectRearrangementDomain_MultiRobot_FD_Explore.pddl"  | 
283 | 281 |     )  | 
284 |  | -    # Automatically generate a multi-robot PDDL problem from DSG (first pass to discover objects)  | 
285 |  | -    # pddl_start_time = time.time()  | 
286 |  | -    full_planning_pipeline(req, G)  | 
287 |  | -    # actual_plan = extract_plan_from_wrapper(plan)  | 
 | 282 | +)  | 
288 | 283 | 
 
  | 
289 | 284 | 
 
  | 
290 |  | -if __name__ == "__main__":  | 
291 |  | -    main()  | 
 | 285 | +# print(f"Loading domain {domain_path}")  | 
 | 286 | +# print(f"Domain name: {domain.domain_name}")  | 
 | 287 | +req = PlanRequest(  | 
 | 288 | +    domain=domain,  | 
 | 289 | +    goal=goal,  | 
 | 290 | +    robot_states=robot_poses,  | 
 | 291 | +)  | 
 | 292 | +# Automatically generate a multi-robot PDDL problem from DSG (first pass to discover objects)  | 
 | 293 | +# pddl_start_time = time.time()  | 
 | 294 | +plan = full_planning_pipeline(req, G)  | 
 | 295 | +print("Symbolic Plan:")  | 
 | 296 | +for a in plan.value.value.symbolic_actions:  | 
 | 297 | +    print(a)  | 
 | 298 | + | 
 | 299 | +adaptor1 = DummyRobotPlanningAdaptor("euclid", "spot", "map", "euclid/body")  | 
 | 300 | +adaptor2 = DummyRobotPlanningAdaptor("hamilton", "spot", "map", "hamilton/body")  | 
 | 301 | +adaptor3 = DummyRobotPlanningAdaptor("gauss", "husky", "map", "husky/body")  | 
 | 302 | +adaptors = {"ROBOT1": adaptor1, "ROBOT2": adaptor2, "ROBOT3": adaptor3}  | 
 | 303 | + | 
 | 304 | +compiled_plans = compile_plan(adaptors, "map", plan)  | 
 | 305 | + | 
 | 306 | +collected_plan = collect_plans(compile_plan(adaptors, "map", plan))  | 
 | 307 | +print("collected plan: ", collected_plan)  | 
0 commit comments