From 672480dfd674c31436878dd52c5fac086dd99ee9 Mon Sep 17 00:00:00 2001 From: bailaC Date: Mon, 8 Jan 2024 16:44:49 +0530 Subject: [PATCH] Issue 695: Changing 'namespace_' variables to 'node_namespace' to make it more explicit (#1239) --- .../controller_interface/controller_interface_base.hpp | 2 +- controller_interface/src/controller_interface_base.cpp | 5 +++-- .../test/test_controller_with_options.hpp | 4 ++-- .../include/controller_manager/controller_manager.hpp | 4 ++-- controller_manager/src/controller_manager.cpp | 8 ++++---- .../test_controller_failed_init.cpp | 2 +- .../test_controller_failed_init.hpp | 2 +- .../test_controller_manager_hardware_error_handling.cpp | 4 ++-- .../test/test_controller_manager_urdf_passing.cpp | 4 ++-- .../test_controllers_chaining_with_controller_manager.cpp | 4 ++-- 10 files changed, 20 insertions(+), 19 deletions(-) diff --git a/controller_interface/include/controller_interface/controller_interface_base.hpp b/controller_interface/include/controller_interface/controller_interface_base.hpp index bbc45c8583..2e953ee932 100644 --- a/controller_interface/include/controller_interface/controller_interface_base.hpp +++ b/controller_interface/include/controller_interface/controller_interface_base.hpp @@ -115,7 +115,7 @@ class ControllerInterfaceBase : public rclcpp_lifecycle::node_interfaces::Lifecy CONTROLLER_INTERFACE_PUBLIC virtual return_type init( const std::string & controller_name, const std::string & urdf, unsigned int cm_update_rate, - const std::string & namespace_ = "", + const std::string & node_namespace = "", const rclcpp::NodeOptions & node_options = rclcpp::NodeOptions().enable_logger_service(true)); /// Custom configure method to read additional parameters for controller-nodes diff --git a/controller_interface/src/controller_interface_base.cpp b/controller_interface/src/controller_interface_base.cpp index 84cd0d5e2b..560feff5f9 100644 --- a/controller_interface/src/controller_interface_base.cpp +++ b/controller_interface/src/controller_interface_base.cpp @@ -26,10 +26,11 @@ namespace controller_interface { return_type ControllerInterfaceBase::init( const std::string & controller_name, const std::string & urdf, unsigned int cm_update_rate, - const std::string & namespace_, const rclcpp::NodeOptions & node_options) + const std::string & node_namespace, const rclcpp::NodeOptions & node_options) { node_ = std::make_shared( - controller_name, namespace_, node_options, false); // disable LifecycleNode service interfaces + controller_name, node_namespace, node_options, + false); // disable LifecycleNode service interfaces urdf_ = urdf; try diff --git a/controller_interface/test/test_controller_with_options.hpp b/controller_interface/test/test_controller_with_options.hpp index 1221536784..1416a7d2df 100644 --- a/controller_interface/test/test_controller_with_options.hpp +++ b/controller_interface/test/test_controller_with_options.hpp @@ -41,13 +41,13 @@ class ControllerWithOptions : public controller_interface::ControllerInterface controller_interface::return_type init( const std::string & controller_name, const std::string & urdf, unsigned int cm_update_rate, - const std::string & namespace_ = "", + const std::string & node_namespace = "", const rclcpp::NodeOptions & node_options = rclcpp::NodeOptions() .allow_undeclared_parameters(true) .automatically_declare_parameters_from_overrides(true)) override { - ControllerInterface::init(controller_name, urdf, cm_update_rate, namespace_, node_options); + ControllerInterface::init(controller_name, urdf, cm_update_rate, node_namespace, node_options); switch (on_init()) { diff --git a/controller_manager/include/controller_manager/controller_manager.hpp b/controller_manager/include/controller_manager/controller_manager.hpp index 79a9861463..44b3c3215a 100644 --- a/controller_manager/include/controller_manager/controller_manager.hpp +++ b/controller_manager/include/controller_manager/controller_manager.hpp @@ -71,14 +71,14 @@ class ControllerManager : public rclcpp::Node std::unique_ptr resource_manager, std::shared_ptr executor, const std::string & manager_node_name = "controller_manager", - const std::string & namespace_ = "", + const std::string & node_namespace = "", const rclcpp::NodeOptions & options = get_cm_node_options()); CONTROLLER_MANAGER_PUBLIC ControllerManager( std::shared_ptr executor, const std::string & manager_node_name = "controller_manager", - const std::string & namespace_ = "", + const std::string & node_namespace = "", const rclcpp::NodeOptions & options = get_cm_node_options()); CONTROLLER_MANAGER_PUBLIC diff --git a/controller_manager/src/controller_manager.cpp b/controller_manager/src/controller_manager.cpp index e1cf41f7e4..270af53fb3 100644 --- a/controller_manager/src/controller_manager.cpp +++ b/controller_manager/src/controller_manager.cpp @@ -255,8 +255,8 @@ rclcpp::NodeOptions get_cm_node_options() ControllerManager::ControllerManager( std::shared_ptr executor, const std::string & manager_node_name, - const std::string & namespace_, const rclcpp::NodeOptions & options) -: rclcpp::Node(manager_node_name, namespace_, options), + const std::string & node_namespace, const rclcpp::NodeOptions & options) +: rclcpp::Node(manager_node_name, node_namespace, options), resource_manager_(std::make_unique( update_rate_, this->get_node_clock_interface())), diagnostics_updater_(this), @@ -297,8 +297,8 @@ ControllerManager::ControllerManager( ControllerManager::ControllerManager( std::unique_ptr resource_manager, std::shared_ptr executor, const std::string & manager_node_name, - const std::string & namespace_, const rclcpp::NodeOptions & options) -: rclcpp::Node(manager_node_name, namespace_, options), + const std::string & node_namespace, const rclcpp::NodeOptions & options) +: rclcpp::Node(manager_node_name, node_namespace, options), resource_manager_(std::move(resource_manager)), diagnostics_updater_(this), executor_(executor), diff --git a/controller_manager/test/test_controller_failed_init/test_controller_failed_init.cpp b/controller_manager/test/test_controller_failed_init/test_controller_failed_init.cpp index 6a6f954e87..a106d5cbdf 100644 --- a/controller_manager/test/test_controller_failed_init/test_controller_failed_init.cpp +++ b/controller_manager/test/test_controller_failed_init/test_controller_failed_init.cpp @@ -33,7 +33,7 @@ TestControllerFailedInit::on_init() controller_interface::return_type TestControllerFailedInit::init( const std::string & /* controller_name */, const std::string & /* urdf */, - unsigned int /*cm_update_rate*/, const std::string & /*namespace_*/, + unsigned int /*cm_update_rate*/, const std::string & /*node_namespace*/, const rclcpp::NodeOptions & /*node_options*/) { return controller_interface::return_type::ERROR; diff --git a/controller_manager/test/test_controller_failed_init/test_controller_failed_init.hpp b/controller_manager/test/test_controller_failed_init/test_controller_failed_init.hpp index 28cb48ab6c..315b0745b0 100644 --- a/controller_manager/test/test_controller_failed_init/test_controller_failed_init.hpp +++ b/controller_manager/test/test_controller_failed_init/test_controller_failed_init.hpp @@ -41,7 +41,7 @@ class TestControllerFailedInit : public controller_interface::ControllerInterfac CONTROLLER_INTERFACE_PUBLIC controller_interface::return_type init( const std::string & controller_name, const std::string & urdf, unsigned int cm_update_rate, - const std::string & namespace_ = "", + const std::string & node_namespace = "", const rclcpp::NodeOptions & node_options = rclcpp::NodeOptions() .allow_undeclared_parameters(true) diff --git a/controller_manager/test/test_controller_manager_hardware_error_handling.cpp b/controller_manager/test/test_controller_manager_hardware_error_handling.cpp index f12ab9e96b..4c800d41c2 100644 --- a/controller_manager/test/test_controller_manager_hardware_error_handling.cpp +++ b/controller_manager/test/test_controller_manager_hardware_error_handling.cpp @@ -54,9 +54,9 @@ class TestableControllerManager : public controller_manager::ControllerManager std::unique_ptr resource_manager, std::shared_ptr executor, const std::string & manager_node_name = "controller_manager", - const std::string & namespace_ = "") + const std::string & node_namespace = "") : controller_manager::ControllerManager( - std::move(resource_manager), executor, manager_node_name, namespace_) + std::move(resource_manager), executor, manager_node_name, node_namespace) { } }; diff --git a/controller_manager/test/test_controller_manager_urdf_passing.cpp b/controller_manager/test/test_controller_manager_urdf_passing.cpp index 102cbdfbd4..5c2ebd14f6 100644 --- a/controller_manager/test/test_controller_manager_urdf_passing.cpp +++ b/controller_manager/test/test_controller_manager_urdf_passing.cpp @@ -40,9 +40,9 @@ class TestableControllerManager : public controller_manager::ControllerManager std::unique_ptr resource_manager, std::shared_ptr executor, const std::string & manager_node_name = "controller_manager", - const std::string & namespace_ = "") + const std::string & node_namespace = "") : controller_manager::ControllerManager( - std::move(resource_manager), executor, manager_node_name, namespace_) + std::move(resource_manager), executor, manager_node_name, node_namespace) { } }; diff --git a/controller_manager/test/test_controllers_chaining_with_controller_manager.cpp b/controller_manager/test/test_controllers_chaining_with_controller_manager.cpp index 0ebddd85e0..eadca39756 100644 --- a/controller_manager/test/test_controllers_chaining_with_controller_manager.cpp +++ b/controller_manager/test/test_controllers_chaining_with_controller_manager.cpp @@ -94,9 +94,9 @@ class TestableControllerManager : public controller_manager::ControllerManager std::unique_ptr resource_manager, std::shared_ptr executor, const std::string & manager_node_name = "controller_manager", - const std::string & namespace_ = "") + const std::string & node_namespace = "") : controller_manager::ControllerManager( - std::move(resource_manager), executor, manager_node_name, namespace_) + std::move(resource_manager), executor, manager_node_name, node_namespace) { } };