Skip to content

Commit f8cedf8

Browse files
authored
Enable unit test for soft object (#39)
1 parent e0e8af6 commit f8cedf8

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

embodichain/lab/sim/sim_manager.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ def asset_uids(self) -> List[str]:
280280
uid_list.extend(list(self._robots.keys()))
281281
uid_list.extend(list(self._rigid_objects.keys()))
282282
uid_list.extend(list(self._rigid_object_groups.keys()))
283+
uid_list.extend(list(self._soft_objects.keys()))
283284
uid_list.extend(list(self._articulations.keys()))
284285
return uid_list
285286

@@ -795,6 +796,20 @@ def get_rigid_object(self, uid: str) -> RigidObject | None:
795796
return None
796797
return self._rigid_objects[uid]
797798

799+
def get_soft_object(self, uid: str) -> SoftObject | None:
800+
"""Get a soft object by its unique ID.
801+
802+
Args:
803+
uid (str): The unique ID of the soft object.
804+
805+
Returns:
806+
SoftObject | None: The soft object instance if found, otherwise None.
807+
"""
808+
if uid not in self._soft_objects:
809+
logger.log_warning(f"Soft object {uid} not found.")
810+
return None
811+
return self._soft_objects[uid]
812+
798813
def get_rigid_object_uid_list(self) -> List[str]:
799814
"""Get current rigid body uid list
800815
@@ -803,6 +818,14 @@ def get_rigid_object_uid_list(self) -> List[str]:
803818
"""
804819
return list(self._rigid_objects.keys())
805820

821+
def get_soft_object_uid_list(self) -> List[str]:
822+
"""Get current soft body uid list
823+
824+
Returns:
825+
List[str]: list of soft body uid.
826+
"""
827+
return list(self._soft_objects.keys())
828+
806829
def add_rigid_object_group(self, cfg: RigidObjectGroupCfg) -> RigidObjectGroup:
807830
"""Add a rigid object group to the scene.
808831

tests/sim/objects/test_soft_object.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ def teardown_method(self):
9292
self.sim.destroy()
9393

9494

95-
@pytest.mark.skip(reason="Skipping SoftObject test now")
9695
class TestSoftObjectCUDA(BaseSoftObjectTest):
9796
def setup_method(self):
9897
self.setup_simulation()

0 commit comments

Comments
 (0)