From 6ba8e67e268a4ac014c511c145a5b53ac19195ba Mon Sep 17 00:00:00 2001 From: Karan Khanna <35415383+Glonks@users.noreply.github.com> Date: Sun, 27 Oct 2024 17:24:56 +0530 Subject: [PATCH] fixed error with not being able to find unpack_parameter_dict when using set_params_from_dict (#220) --- .../jinja_templates/python/parameter_library_header | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/generate_parameter_library_py/generate_parameter_library_py/jinja_templates/python/parameter_library_header b/generate_parameter_library_py/generate_parameter_library_py/jinja_templates/python/parameter_library_header index 2247da3..0bfb5b5 100644 --- a/generate_parameter_library_py/generate_parameter_library_py/jinja_templates/python/parameter_library_header +++ b/generate_parameter_library_py/generate_parameter_library_py/jinja_templates/python/parameter_library_header @@ -54,8 +54,7 @@ stamp_ = Time() def is_old(self, other_param): return self.params_.stamp_ != other_param.stamp_ - @staticmethod - def unpack_parameter_dict(namespace: str, parameter_dict: dict): + def unpack_parameter_dict(self, namespace: str, parameter_dict: dict): """ Flatten a parameter dictionary recursively. @@ -68,7 +67,7 @@ stamp_ = Time() full_param_name = namespace + param_name # Unroll nested parameters if isinstance(param_value, dict): - nested_params = unpack_parameter_dict( + nested_params = self.unpack_parameter_dict( namespace=full_param_name + rclpy.parameter.PARAMETER_SEPARATOR_STRING, parameter_dict=param_value) parameters.extend(nested_params) @@ -77,7 +76,7 @@ stamp_ = Time() return parameters def set_params_from_dict(self, param_dict): - params_to_set = unpack_parameter_dict('', param_dict) + params_to_set = self.unpack_parameter_dict('', param_dict) self.update(params_to_set) def refresh_dynamic_parameters(self):