From f846880ea5ff8a6f0f3c87f3d3502520210efe63 Mon Sep 17 00:00:00 2001 From: Manuel Schweiger Date: Sat, 28 Dec 2024 14:01:09 +0100 Subject: [PATCH 1/4] test: add unittest for dict conversion of ActuatorCfg --- .../test/utils/test_configclass.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/source/extensions/omni.isaac.lab/test/utils/test_configclass.py b/source/extensions/omni.isaac.lab/test/utils/test_configclass.py index bb4b3e5999..1da1170b83 100644 --- a/source/extensions/omni.isaac.lab/test/utils/test_configclass.py +++ b/source/extensions/omni.isaac.lab/test/utils/test_configclass.py @@ -143,6 +143,15 @@ class BasicDemoTorchCfg: some_tensor: torch.Tensor = torch.Tensor([1, 2, 3]) +@configclass +class BasicActuatorCfg(): + """Dummy configuration class for ActuatorBase config.""" + joint_names_expr: list[str] = ["some_string"] + joint_parameter_lookup: torch.Tensor = torch.Tensor([1, 2, 3]) + stiffness: float = 1.0 + damping: float = 2.0 + + """ Dummy configuration to check type annotations ordering. """ @@ -530,6 +539,18 @@ def test_dict_conversion(self): self.assertEqual(torch_cfg_dict["some_number"], 0) self.assertTrue(torch.all(torch_cfg_dict["some_tensor"] == torch.tensor([1, 2, 3]))) + def test_actuator_cfg_dict_conversion(self): + """Test dict conversion of ActuatorConfig.""" + # create a basic actuator config with a Torch.Tensor (joint_parameter_lookup) + actuator_cfg = BasicActuatorCfg() + # return writable attributes of config object + actuator_cfg_dict_attr = actuator_cfg.__dict__ + # check if __dict__ attribute of config is not empty + self.assertTrue(len(actuator_cfg_dict_attr) > 0) + # class_to_dict utility function should return a primitive dictionary + actuator_cfg_dict = class_to_dict(actuator_cfg.joint_parameter_lookup) + self.assertTrue(isinstance(actuator_cfg_dict, dict)) + def test_dict_conversion_order(self): """Tests that order is conserved when converting to dictionary.""" true_outer_order = ["device_id", "env", "robot_default_state", "list_config"] From 057828046569378f4748ec9694056be63f679d46 Mon Sep 17 00:00:00 2001 From: Manuel Schweiger Date: Sat, 28 Dec 2024 14:06:22 +0100 Subject: [PATCH 2/4] chore: ran isaaclab formatter using --format --- .../extensions/omni.isaac.lab/test/utils/test_configclass.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/extensions/omni.isaac.lab/test/utils/test_configclass.py b/source/extensions/omni.isaac.lab/test/utils/test_configclass.py index 1da1170b83..ec4a34a450 100644 --- a/source/extensions/omni.isaac.lab/test/utils/test_configclass.py +++ b/source/extensions/omni.isaac.lab/test/utils/test_configclass.py @@ -144,8 +144,9 @@ class BasicDemoTorchCfg: @configclass -class BasicActuatorCfg(): +class BasicActuatorCfg: """Dummy configuration class for ActuatorBase config.""" + joint_names_expr: list[str] = ["some_string"] joint_parameter_lookup: torch.Tensor = torch.Tensor([1, 2, 3]) stiffness: float = 1.0 From 2675b2140813012467944edbd493f805a83fdb54 Mon Sep 17 00:00:00 2001 From: Manuel Schweiger Date: Sat, 28 Dec 2024 14:10:06 +0100 Subject: [PATCH 3/4] chore: add name to contributors --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5ae174987b..a8dfa39a48 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -84,6 +84,7 @@ Guidelines for modifications: * Yujian Zhang * Zhengyu Zhang * Ziqi Fan +* Manuel Schweiger ## Acknowledgements From d802a56564f4e0062f93926a35b1491d19ad45a9 Mon Sep 17 00:00:00 2001 From: Manuel Schweiger Date: Thu, 2 Jan 2025 18:46:16 +0100 Subject: [PATCH 4/4] chore: update contributors --- CONTRIBUTORS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index a8dfa39a48..fc17a63eb8 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -62,6 +62,7 @@ Guidelines for modifications: * Lionel Gulich * Louis Le Lay * Lorenz Wellhausen +* Manuel Schweiger * Masoud Moghani * Michael Gussert * Michael Noseworthy @@ -84,7 +85,6 @@ Guidelines for modifications: * Yujian Zhang * Zhengyu Zhang * Ziqi Fan -* Manuel Schweiger ## Acknowledgements