diff --git a/pyrobosim/examples/demo.py b/pyrobosim/examples/demo.py index 6c6f8fca..9b12053a 100755 --- a/pyrobosim/examples/demo.py +++ b/pyrobosim/examples/demo.py @@ -29,13 +29,14 @@ def create_world(multirobot=False): # Set the location and object metadata world.add_metadata( - locations=os.path.join(data_folder, "example_location_data_furniture.yaml"), - objects=os.path.join(data_folder, "example_object_data_food.yaml"), - ) - - world.add_metadata( - locations=[os.path.join(data_folder, "example_location_data_accessories.yaml")], - objects=[os.path.join(data_folder, "example_object_data_drink.yaml")], + locations=[ + os.path.join(data_folder, "example_location_data_furniture.yaml"), + os.path.join(data_folder, "example_location_data_accessories.yaml"), + ], + objects=[ + os.path.join(data_folder, "example_object_data_food.yaml"), + os.path.join(data_folder, "example_object_data_drink.yaml"), + ], ) # Add rooms diff --git a/pyrobosim/test/core/test_world.py b/pyrobosim/test/core/test_world.py index 59919b65..dab66a58 100644 --- a/pyrobosim/test/core/test_world.py +++ b/pyrobosim/test/core/test_world.py @@ -21,18 +21,22 @@ def test_create_world_default(): """Tests the creation of a world""" TestWorldModeling.world = World() + # to reset the sources from previous testcases + TestWorldModeling.world.get_location_metadata().sources = [] + TestWorldModeling.world.get_object_metadata().sources = [] data_folder = get_data_folder() TestWorldModeling.world.set_metadata( - locations=os.path.join(data_folder, "example_location_data_furniture.yaml"), - objects=os.path.join(data_folder, "example_object_data_food.yaml"), - ) - TestWorldModeling.world.add_metadata( locations=[ - os.path.join(data_folder, "example_location_data_accessories.yaml") + os.path.join(data_folder, "example_location_data_furniture.yaml"), + os.path.join(data_folder, "example_location_data_accessories.yaml"), + ], + objects=[ + os.path.join(data_folder, "example_object_data_food.yaml"), + os.path.join(data_folder, "example_object_data_drink.yaml"), ], - objects=[os.path.join(data_folder, "example_object_data_drink.yaml")], ) + assert isinstance(TestWorldModeling.world, World) assert len(TestWorldModeling.world.get_location_metadata().sources) == 2 assert len(TestWorldModeling.world.get_object_metadata().sources) == 2 diff --git a/pyrobosim_ros/examples/demo.py b/pyrobosim_ros/examples/demo.py index 958afead..b1d4c2f9 100755 --- a/pyrobosim_ros/examples/demo.py +++ b/pyrobosim_ros/examples/demo.py @@ -26,13 +26,14 @@ def create_world(): # Set the location and object metadata world.add_metadata( - locations=os.path.join(data_folder, "example_location_data_furniture.yaml"), - objects=os.path.join(data_folder, "example_object_data_food.yaml"), - ) - - world.add_metadata( - locations=[os.path.join(data_folder, "example_location_data_accessories.yaml")], - objects=[os.path.join(data_folder, "example_object_data_drink.yaml")], + locations=[ + os.path.join(data_folder, "example_location_data_furniture.yaml"), + os.path.join(data_folder, "example_location_data_accessories.yaml"), + ], + objects=[ + os.path.join(data_folder, "example_object_data_food.yaml"), + os.path.join(data_folder, "example_object_data_drink.yaml"), + ], ) # Add rooms