Skip to content

Commit

Permalink
[MultiverseTest] added check for if apartment already exists before s…
Browse files Browse the repository at this point in the history
…pawning it again.
  • Loading branch information
AbdelrhmanBassiouny committed Oct 11, 2024
1 parent 97169d0 commit 2b8f0fc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/test_multiverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ def test_save_and_restore_state(self):
milk = self.spawn_milk([1, 1, 0.1])
robot = self.spawn_robot()
cup = self.spawn_cup([1, 2, 0.1])
apartment = Object("apartment", ObjectType.ENVIRONMENT, f"apartment.urdf")
if "apartment" not in self.multiverse.get_object_names():
apartment = Object("apartment", ObjectType.ENVIRONMENT, f"apartment.urdf")
else:
apartment = self.multiverse.get_object_by_name("apartment")
apartment.set_joint_position("cabinet10_drawer1_joint", 0.1)
robot.attach(milk)
milk.attach(cup)
Expand Down Expand Up @@ -302,7 +305,10 @@ def step_robot_pose(self, robot, position_step, angle_step, num_steps):
orientation_delta=self.multiverse.conf.orientation_tolerance)

def test_get_environment_pose(self):
apartment = Object("apartment", ObjectType.ENVIRONMENT, f"apartment.urdf")
if "apartment" not in self.multiverse.get_object_names():
apartment = Object("apartment", ObjectType.ENVIRONMENT, f"apartment.urdf")
else:
apartment = self.multiverse.get_object_by_name("apartment")
pose = apartment.get_pose()
self.assertIsInstance(pose, Pose)

Expand Down

0 comments on commit 2b8f0fc

Please sign in to comment.