Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds dict conversion test for ActuatorBase configs #1608

Merged
merged 8 commits into from
Jan 13, 2025
Prev Previous commit
Next Next commit
fix: update unittest to new actuatorconfig
  • Loading branch information
mschweig committed Jan 12, 2025
commit 7a3ba4dd0f439502d2597595956f438ec64c8d1d
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ 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])
joint_parameter_lookup: list[list[float]] = [[1, 2, 3], [4, 5, 6]]
stiffness: float = 1.0
damping: float = 2.0

Expand Down Expand Up @@ -542,14 +542,14 @@ def test_dict_conversion(self):

def test_actuator_cfg_dict_conversion(self):
"""Test dict conversion of ActuatorConfig."""
# create a basic actuator config with a Torch.Tensor (joint_parameter_lookup)
# create a basic RemotizedPDActuator config
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)
actuator_cfg_dict = class_to_dict(actuator_cfg)
self.assertTrue(isinstance(actuator_cfg_dict, dict))

def test_dict_conversion_order(self):
Expand Down
Loading