From a8baa3ce8899c81a6936205fa9e86183933b6483 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 3 Dec 2021 16:24:28 -0300 Subject: [PATCH] add node_waitables_ to copy constructor. (backport #1799) (#1834) * add node_waitables_ to copy constructor. Signed-off-by: Tomoya Fujita * add node_time_source_ to copy constructor. Signed-off-by: Tomoya Fujita * add construction_and_destruction_sub_node for action server. Signed-off-by: Tomoya Fujita Co-authored-by: Abrar Rahman Protyasha (cherry picked from commit 301957515a0448de22def36559087b3338c76700) Co-authored-by: Tomoya Fujita --- rclcpp/src/rclcpp/node.cpp | 2 ++ rclcpp_action/test/test_server.cpp | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/rclcpp/src/rclcpp/node.cpp b/rclcpp/src/rclcpp/node.cpp index 7cc352b..7f30b36 100644 --- a/rclcpp/src/rclcpp/node.cpp +++ b/rclcpp/src/rclcpp/node.cpp @@ -168,6 +168,8 @@ Node::Node( node_services_(other.node_services_), node_clock_(other.node_clock_), node_parameters_(other.node_parameters_), + node_time_source_(other.node_time_source_), + node_waitables_(other.node_waitables_), node_options_(other.node_options_), sub_namespace_(extend_sub_namespace(other.get_sub_namespace(), sub_namespace)), effective_namespace_(create_effective_namespace(other.get_namespace(), sub_namespace_)) diff --git a/rclcpp_action/test/test_server.cpp b/rclcpp_action/test/test_server.cpp index c9d780d..bf31c06 100644 --- a/rclcpp_action/test/test_server.cpp +++ b/rclcpp_action/test/test_server.cpp @@ -205,6 +205,27 @@ TEST_F(TestServer, construction_and_destruction_wait_set_error) }, rclcpp::exceptions::RCLError); } +TEST_F(TestServer, construction_and_destruction_sub_node) +{ + auto parent_node = std::make_shared("construct_node", "/rclcpp_action/construct"); + auto sub_node = parent_node->create_sub_node("construct_sub_node"); + + ASSERT_NO_THROW( + { + using GoalHandle = rclcpp_action::ServerGoalHandle; + auto as = rclcpp_action::create_server( + sub_node, "fibonacci", + [](const GoalUUID &, std::shared_ptr) { + return rclcpp_action::GoalResponse::REJECT; + }, + [](std::shared_ptr) { + return rclcpp_action::CancelResponse::REJECT; + }, + [](std::shared_ptr) {}); + (void)as; + }); +} + TEST_F(TestServer, handle_goal_called) { auto node = std::make_shared("handle_goal_node", "/rclcpp_action/handle_goal");