From 035641300b3cd61c4041a6969b0221b5529b4eb5 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 c6a1479cda..fa8fec27ba 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);