From 696d9ed1be0b18d3f7b2392ffdde22c0fb5a3215 Mon Sep 17 00:00:00 2001 From: tomoya Date: Wed, 17 Jun 2020 07:03:35 +0900 Subject: [PATCH] add rcl_action_client_options when creating action client. (#1133) * add rcl_action_client_options for create_client. Signed-off-by: Tomoya.Fujita * Capitalize comments and keep the default rcl_action_client_options. Signed-off-by: Tomoya.Fujita * delete unnecessary default rcl_action_client_options_t. Signed-off-by: Tomoya.Fujita --- rclcpp/include/rclcpp/publisher.hpp | 2 +- rclcpp/include/rclcpp/subscription.hpp | 2 +- rclcpp/include/rclcpp/subscription_base.hpp | 2 +- rclcpp_action/include/rclcpp_action/client.hpp | 2 +- .../include/rclcpp_action/create_client.hpp | 14 ++++++++++---- .../include/rclcpp_action/create_server.hpp | 4 ++-- rclcpp_action/include/rclcpp_action/server.hpp | 2 +- rclcpp_action/test/test_client.cpp | 4 +++- 8 files changed, 20 insertions(+), 12 deletions(-) diff --git a/rclcpp/include/rclcpp/publisher.hpp b/rclcpp/include/rclcpp/publisher.hpp index 8518353574..d8b572c90c 100644 --- a/rclcpp/include/rclcpp/publisher.hpp +++ b/rclcpp/include/rclcpp/publisher.hpp @@ -68,7 +68,7 @@ class Publisher : public PublisherBase * \param[in] node_base NodeBaseInterface pointer that is used in part of the setup. * \param[in] topic Name of the topic to publish to. * \param[in] qos QoS profile for Subcription. - * \param[in] options options for the subscription. + * \param[in] options Options for the subscription. */ Publisher( rclcpp::node_interfaces::NodeBaseInterface * node_base, diff --git a/rclcpp/include/rclcpp/subscription.hpp b/rclcpp/include/rclcpp/subscription.hpp index b567d1910e..679a0c8ff1 100644 --- a/rclcpp/include/rclcpp/subscription.hpp +++ b/rclcpp/include/rclcpp/subscription.hpp @@ -92,7 +92,7 @@ class Subscription : public SubscriptionBase * \param[in] topic_name Name of the topic to subscribe to. * \param[in] qos QoS profile for Subcription. * \param[in] callback User defined callback to call when a message is received. - * \param[in] options options for the subscription. + * \param[in] options Options for the subscription. * \param[in] message_memory_strategy The memory strategy to be used for managing message memory. * \param[in] subscription_topic_statistics Optional pointer to a topic statistics subcription. * \throws std::invalid_argument if the QoS is uncompatible with intra-process (if one diff --git a/rclcpp/include/rclcpp/subscription_base.hpp b/rclcpp/include/rclcpp/subscription_base.hpp index 68df9211bd..28b92ffb13 100644 --- a/rclcpp/include/rclcpp/subscription_base.hpp +++ b/rclcpp/include/rclcpp/subscription_base.hpp @@ -66,7 +66,7 @@ class SubscriptionBase : public std::enable_shared_from_this * \param[in] node_base NodeBaseInterface pointer used in parts of the setup. * \param[in] type_support_handle rosidl type support struct, for the Message type of the topic. * \param[in] topic_name Name of the topic to subscribe to. - * \param[in] subscription_options options for the subscription. + * \param[in] subscription_options Options for the subscription. * \param[in] is_serialized is true if the message will be delivered still serialized */ RCLCPP_PUBLIC diff --git a/rclcpp_action/include/rclcpp_action/client.hpp b/rclcpp_action/include/rclcpp_action/client.hpp index 71b0c866a0..a46e008f33 100644 --- a/rclcpp_action/include/rclcpp_action/client.hpp +++ b/rclcpp_action/include/rclcpp_action/client.hpp @@ -317,7 +317,7 @@ class Client : public ClientBase rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph, rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr node_logging, const std::string & action_name, - const rcl_action_client_options_t client_options = rcl_action_client_get_default_options() + const rcl_action_client_options_t & client_options = rcl_action_client_get_default_options() ) : ClientBase( node_base, node_graph, node_logging, action_name, diff --git a/rclcpp_action/include/rclcpp_action/create_client.hpp b/rclcpp_action/include/rclcpp_action/create_client.hpp index 7c3f210cb6..8538a8205e 100644 --- a/rclcpp_action/include/rclcpp_action/create_client.hpp +++ b/rclcpp_action/include/rclcpp_action/create_client.hpp @@ -37,6 +37,7 @@ namespace rclcpp_action * \param[in] name The action name. * \param[in] group The action client will be added to this callback group. * If `nullptr`, then the action client is added to the default callback group. + * \param[in] options Options to pass to the underlying `rcl_action_client_t`. */ template typename Client::SharedPtr @@ -46,7 +47,8 @@ create_client( rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr node_logging_interface, rclcpp::node_interfaces::NodeWaitablesInterface::SharedPtr node_waitables_interface, const std::string & name, - rclcpp::CallbackGroup::SharedPtr group = nullptr) + rclcpp::CallbackGroup::SharedPtr group = nullptr, + const rcl_action_client_options_t & options = rcl_action_client_get_default_options()) { std::weak_ptr weak_node = node_waitables_interface; @@ -82,7 +84,8 @@ create_client( node_base_interface, node_graph_interface, node_logging_interface, - name), + name, + options), deleter); node_waitables_interface->add_waitable(action_client, group); @@ -95,13 +98,15 @@ create_client( * \param[in] name The action name. * \param[in] group The action client will be added to this callback group. * If `nullptr`, then the action client is added to the default callback group. + * \param[in] options Options to pass to the underlying `rcl_action_client_t`. */ template typename Client::SharedPtr create_client( NodeT node, const std::string & name, - rclcpp::CallbackGroup::SharedPtr group = nullptr) + rclcpp::CallbackGroup::SharedPtr group = nullptr, + const rcl_action_client_options_t & options = rcl_action_client_get_default_options()) { return rclcpp_action::create_client( node->get_node_base_interface(), @@ -109,7 +114,8 @@ create_client( node->get_node_logging_interface(), node->get_node_waitables_interface(), name, - group); + group, + options); } } // namespace rclcpp_action diff --git a/rclcpp_action/include/rclcpp_action/create_server.hpp b/rclcpp_action/include/rclcpp_action/create_server.hpp index 189bc710a4..9116fc05ee 100644 --- a/rclcpp_action/include/rclcpp_action/create_server.hpp +++ b/rclcpp_action/include/rclcpp_action/create_server.hpp @@ -49,7 +49,7 @@ namespace rclcpp_action * The return from this callback only indicates if the server will try to cancel a goal. * It does not indicate if the goal was actually canceled. * \param[in] handle_accepted A callback that is called to give the user a handle to the goal. - * \param[in] options options to pass to the underlying `rcl_action_server_t`. + * \param[in] options Options to pass to the underlying `rcl_action_server_t`. * \param[in] group The action server will be added to this callback group. * If `nullptr`, then the action server is added to the default callback group. */ @@ -123,7 +123,7 @@ create_server( * The return from this callback only indicates if the server will try to cancel a goal. * It does not indicate if the goal was actually canceled. * \param[in] handle_accepted A callback that is called to give the user a handle to the goal. - * \param[in] options options to pass to the underlying `rcl_action_server_t`. + * \param[in] options Options to pass to the underlying `rcl_action_server_t`. * \param[in] group The action server will be added to this callback group. * If `nullptr`, then the action server is added to the default callback group. */ diff --git a/rclcpp_action/include/rclcpp_action/server.hpp b/rclcpp_action/include/rclcpp_action/server.hpp index 7aede9ae69..c5ff2c1d8c 100644 --- a/rclcpp_action/include/rclcpp_action/server.hpp +++ b/rclcpp_action/include/rclcpp_action/server.hpp @@ -296,7 +296,7 @@ class Server : public ServerBase, public std::enable_shared_from_thiscreate_callback_group( rclcpp::CallbackGroupType::MutuallyExclusive); + const rcl_action_client_options_t & options = rcl_action_client_get_default_options(); ASSERT_NO_THROW( rclcpp_action::create_client( client_node->get_node_base_interface(), @@ -320,7 +321,8 @@ TEST_F(TestClient, construction_and_destruction_callback_group) client_node->get_node_logging_interface(), client_node->get_node_waitables_interface(), action_name, - group + group, + options ).reset()); }