diff --git a/samples/ros2_cpp_all_pkg/src/ros2_cpp_node.cpp b/samples/ros2_cpp_all_pkg/src/ros2_cpp_node.cpp index c6fb53d..c9997ab 100644 --- a/samples/ros2_cpp_all_pkg/src/ros2_cpp_node.cpp +++ b/samples/ros2_cpp_all_pkg/src/ros2_cpp_node.cpp @@ -104,6 +104,7 @@ void Ros2CppNode::declareAndLoadParameter(const std::string& name, ss << param; } RCLCPP_WARN_STREAM(this->get_logger(), ss.str()); + this->set_parameters({rclcpp::Parameter(name, rclcpp::ParameterValue(param))}); } } diff --git a/samples/ros2_cpp_component_pkg/src/ros2_cpp_node.cpp b/samples/ros2_cpp_component_pkg/src/ros2_cpp_node.cpp index 9a59593..f652eab 100644 --- a/samples/ros2_cpp_component_pkg/src/ros2_cpp_node.cpp +++ b/samples/ros2_cpp_component_pkg/src/ros2_cpp_node.cpp @@ -97,6 +97,7 @@ void Ros2CppNode::declareAndLoadParameter(const std::string& name, ss << param; } RCLCPP_WARN_STREAM(this->get_logger(), ss.str()); + this->set_parameters({rclcpp::Parameter(name, rclcpp::ParameterValue(param))}); } } diff --git a/samples/ros2_cpp_lifecycle_pkg/src/ros2_cpp_node.cpp b/samples/ros2_cpp_lifecycle_pkg/src/ros2_cpp_node.cpp index f0bdd4e..ab5311b 100644 --- a/samples/ros2_cpp_lifecycle_pkg/src/ros2_cpp_node.cpp +++ b/samples/ros2_cpp_lifecycle_pkg/src/ros2_cpp_node.cpp @@ -99,6 +99,7 @@ void Ros2CppNode::declareAndLoadParameter(const std::string& name, ss << param; } RCLCPP_WARN_STREAM(this->get_logger(), ss.str()); + this->set_parameters({rclcpp::Parameter(name, rclcpp::ParameterValue(param))}); } } diff --git a/samples/ros2_cpp_pkg/src/ros2_cpp_node.cpp b/samples/ros2_cpp_pkg/src/ros2_cpp_node.cpp index 15ae866..c700c4e 100644 --- a/samples/ros2_cpp_pkg/src/ros2_cpp_node.cpp +++ b/samples/ros2_cpp_pkg/src/ros2_cpp_node.cpp @@ -94,6 +94,7 @@ void Ros2CppNode::declareAndLoadParameter(const std::string& name, ss << param; } RCLCPP_WARN_STREAM(this->get_logger(), ss.str()); + this->set_parameters({rclcpp::Parameter(name, rclcpp::ParameterValue(param))}); } } diff --git a/samples/ros2_python_all_pkg/ros2_python_all_pkg/ros2_python_node.py b/samples/ros2_python_all_pkg/ros2_python_all_pkg/ros2_python_node.py index f5b1016..e21ff10 100644 --- a/samples/ros2_python_all_pkg/ros2_python_all_pkg/ros2_python_node.py +++ b/samples/ros2_python_all_pkg/ros2_python_all_pkg/ros2_python_node.py @@ -91,6 +91,7 @@ def declareAndLoadParameter(self, else: self.get_logger().warn(f"Missing parameter '{name}', using default value: {default}") param = default + self.set_parameters([rclpy.Parameter(name=name, value=param)]) # add parameter to auto-reconfigurable parameters if add_to_auto_reconfigurable_params: diff --git a/samples/ros2_python_pkg/ros2_python_pkg/ros2_python_node.py b/samples/ros2_python_pkg/ros2_python_pkg/ros2_python_node.py index 664bd43..ad58f33 100644 --- a/samples/ros2_python_pkg/ros2_python_pkg/ros2_python_node.py +++ b/samples/ros2_python_pkg/ros2_python_pkg/ros2_python_node.py @@ -87,6 +87,7 @@ def declareAndLoadParameter(self, else: self.get_logger().warn(f"Missing parameter '{name}', using default value: {default}") param = default + self.set_parameters([rclpy.Parameter(name=name, value=param)]) # add parameter to auto-reconfigurable parameters if add_to_auto_reconfigurable_params: diff --git a/templates/ros2_cpp_pkg/{{ package_name }}/src/{{ node_name }}.cpp.jinja b/templates/ros2_cpp_pkg/{{ package_name }}/src/{{ node_name }}.cpp.jinja index 02ee49d..6ad60d9 100644 --- a/templates/ros2_cpp_pkg/{{ package_name }}/src/{{ node_name }}.cpp.jinja +++ b/templates/ros2_cpp_pkg/{{ package_name }}/src/{{ node_name }}.cpp.jinja @@ -128,6 +128,7 @@ void {{ node_class_name }}::declareAndLoadParameter(const std::string& name, ss << param; } RCLCPP_WARN_STREAM(this->get_logger(), ss.str()); + this->set_parameters({rclcpp::Parameter(name, rclcpp::ParameterValue(param))}); } } diff --git a/templates/ros2_python_pkg/{{ package_name }}/{{ package_name }}/{{ node_name }}.py.jinja b/templates/ros2_python_pkg/{{ package_name }}/{{ package_name }}/{{ node_name }}.py.jinja index 784b2ef..55df51c 100644 --- a/templates/ros2_python_pkg/{{ package_name }}/{{ package_name }}/{{ node_name }}.py.jinja +++ b/templates/ros2_python_pkg/{{ package_name }}/{{ package_name }}/{{ node_name }}.py.jinja @@ -108,6 +108,7 @@ class {{ node_class_name }}(Node): else: self.get_logger().warn(f"Missing parameter '{name}', using default value: {default}") param = default + self.set_parameters([rclpy.Parameter(name=name, value=param)]) # add parameter to auto-reconfigurable parameters if add_to_auto_reconfigurable_params: