-
Notifications
You must be signed in to change notification settings - Fork 60
Closed
Description
When using the new feature to set params from a dict, the node fails with the following error:
NameError: name 'unpack_parameter_dict' is not defined
I think the error comes from here:
Lines 57 to 80 in 28b1870
@staticmethod | |
def unpack_parameter_dict(namespace: str, parameter_dict: dict): | |
""" | |
Flatten a parameter dictionary recursively. | |
:param namespace: The namespace to prepend to the parameter names. | |
:param parameter_dict: A dictionary of parameters keyed by the parameter names | |
:return: A list of rclpy Parameter objects | |
""" | |
parameters = [] | |
for param_name, param_value in parameter_dict.items(): | |
full_param_name = namespace + param_name | |
# Unroll nested parameters | |
if isinstance(param_value, dict): | |
nested_params = unpack_parameter_dict( | |
namespace=full_param_name + rclpy.parameter.PARAMETER_SEPARATOR_STRING, | |
parameter_dict=param_value) | |
parameters.extend(nested_params) | |
else: | |
parameters.append(rclpy.parameter.Parameter(full_param_name, value=param_value)) | |
return parameters | |
def set_params_from_dict(self, param_dict): | |
params_to_set = unpack_parameter_dict('', param_dict) |
The method is not referred to via self, and so python fails to find it.
Testing locally, simply removing @staticmethod and adding self seems to solve the issue.
Metadata
Metadata
Assignees
Labels
No labels