From 41d97c5d272076d32e417c126ab3ea2803db2c74 Mon Sep 17 00:00:00 2001 From: Daisuke Sato <43101027+daisukes@users.noreply.github.com> Date: Wed, 27 May 2020 14:28:54 -0400 Subject: [PATCH] a bugfix of clear costmap service action (#1764) The following is an example of the error. [ERROR] [1590171638.335693813] [bt_navigator]: Action server failed while executing action callback: "failed to send request: ros_request argument is null, at /opt/ros/src/ros2/rcl/rcl/src/rcl/client.c:278"a bugfix of clear costmap service action Signed-off-by: Daisuke Sato <daisukes@cmu.edu> --- .../include/nav2_behavior_tree/bt_service_node.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/bt_service_node.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/bt_service_node.hpp index 2b51e58b..29a4cc10 100644 --- a/nav2_behavior_tree/include/nav2_behavior_tree/bt_service_node.hpp +++ b/nav2_behavior_tree/include/nav2_behavior_tree/bt_service_node.hpp @@ -45,6 +45,9 @@ public: getInput("service_name", service_name_); service_client_ = node_->create_client<ServiceT>(service_name_); + // Make a request for the service without parameter + request_ = std::make_shared<typename ServiceT::Request>(); + // Make sure the server is actually there before continuing RCLCPP_INFO( node_->get_logger(), "Waiting for \"%s\" service", @@ -91,7 +94,6 @@ public: // Fill in service request with information if necessary virtual void on_tick() { - request_ = std::make_shared<typename ServiceT::Request>(); } // Check the future and decide the status of Behaviortree -- GitLab