add node_waitables_ to copy constructor. (backport #1799) (#1834)

* add node_waitables_ to copy constructor.

Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>

* add node_time_source_ to copy constructor.

Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>

* add construction_and_destruction_sub_node for action server.

Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>

Co-authored-by: Abrar Rahman Protyasha <abrar@openrobotics.org>
(cherry picked from commit 301957515a0448de22def36559087b3338c76700)

Co-authored-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
This commit is contained in:
mergify[bot] 2021-12-03 16:24:28 -03:00 committed by GitHub
parent a58f8c1de4
commit a8baa3ce88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View file

@ -168,6 +168,8 @@ Node::Node(
node_services_(other.node_services_), node_services_(other.node_services_),
node_clock_(other.node_clock_), node_clock_(other.node_clock_),
node_parameters_(other.node_parameters_), node_parameters_(other.node_parameters_),
node_time_source_(other.node_time_source_),
node_waitables_(other.node_waitables_),
node_options_(other.node_options_), node_options_(other.node_options_),
sub_namespace_(extend_sub_namespace(other.get_sub_namespace(), sub_namespace)), sub_namespace_(extend_sub_namespace(other.get_sub_namespace(), sub_namespace)),
effective_namespace_(create_effective_namespace(other.get_namespace(), sub_namespace_)) effective_namespace_(create_effective_namespace(other.get_namespace(), sub_namespace_))

View file

@ -205,6 +205,27 @@ TEST_F(TestServer, construction_and_destruction_wait_set_error)
}, rclcpp::exceptions::RCLError); }, rclcpp::exceptions::RCLError);
} }
TEST_F(TestServer, construction_and_destruction_sub_node)
{
auto parent_node = std::make_shared<rclcpp::Node>("construct_node", "/rclcpp_action/construct");
auto sub_node = parent_node->create_sub_node("construct_sub_node");
ASSERT_NO_THROW(
{
using GoalHandle = rclcpp_action::ServerGoalHandle<Fibonacci>;
auto as = rclcpp_action::create_server<Fibonacci>(
sub_node, "fibonacci",
[](const GoalUUID &, std::shared_ptr<const Fibonacci::Goal>) {
return rclcpp_action::GoalResponse::REJECT;
},
[](std::shared_ptr<GoalHandle>) {
return rclcpp_action::CancelResponse::REJECT;
},
[](std::shared_ptr<GoalHandle>) {});
(void)as;
});
}
TEST_F(TestServer, handle_goal_called) TEST_F(TestServer, handle_goal_called)
{ {
auto node = std::make_shared<rclcpp::Node>("handle_goal_node", "/rclcpp_action/handle_goal"); auto node = std::make_shared<rclcpp::Node>("handle_goal_node", "/rclcpp_action/handle_goal");