Skip to content

Commit d028caa

Browse files
anaelle-swSteveMacenski
authored andcommitted
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
1 parent f116316 commit d028caa

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,16 @@ bool BtActionServer<ActionT>::on_configure()
8282
throw std::runtime_error{"Failed to lock node"};
8383
}
8484

85-
// use suffix '_rclcpp_node' to keep parameter file consistency #1773
85+
// Name client node after action name
86+
std::string client_node_name = action_name_;
87+
std::replace(client_node_name.begin(), client_node_name.end(), '/', '_');
88+
// Use suffix '_rclcpp_node' to keep parameter file consistency #1773
8689
auto options = rclcpp::NodeOptions().arguments(
8790
{"--ros-args",
88-
"-r", std::string("__node:=") + std::string(node->get_name()) + action_name_ + "_rclcpp_node",
91+
"-r",
92+
std::string("__node:=") + std::string(node->get_name()) + client_node_name + "_rclcpp_node",
8993
"--"});
94+
9095
// Support for handling the topic-based goal pose from rviz
9196
client_node_ = std::make_shared<rclcpp::Node>("_", options);
9297

0 commit comments

Comments
 (0)