From d028caa20474f9215f0d080d4b46cc16a493730d Mon Sep 17 00:00:00 2001 From: anaelle-sw <63144493+anaelle-sw@users.noreply.github.com> Date: Mon, 26 Jul 2021 20:04:47 +0200 Subject: [PATCH] Naming BT client node after action name (#2470) * Put action name in node namespace instead of node name * Put namespace remapping in node options * Rename client node with action name replacing "/" by "_" * Code formatting * Code formatting --- .../include/nav2_behavior_tree/bt_action_server_impl.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp index 63be703442..64f4ffa81b 100644 --- a/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp +++ b/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp @@ -82,11 +82,16 @@ bool BtActionServer::on_configure() throw std::runtime_error{"Failed to lock node"}; } - // use suffix '_rclcpp_node' to keep parameter file consistency #1773 + // Name client node after action name + std::string client_node_name = action_name_; + std::replace(client_node_name.begin(), client_node_name.end(), '/', '_'); + // Use suffix '_rclcpp_node' to keep parameter file consistency #1773 auto options = rclcpp::NodeOptions().arguments( {"--ros-args", - "-r", std::string("__node:=") + std::string(node->get_name()) + action_name_ + "_rclcpp_node", + "-r", + std::string("__node:=") + std::string(node->get_name()) + client_node_name + "_rclcpp_node", "--"}); + // Support for handling the topic-based goal pose from rviz client_node_ = std::make_shared("_", options);