Expose QoS profile in create_service and create_client

This commit is contained in:
Jackie Kay 2015-11-11 18:41:09 -08:00
parent 24f9df6102
commit 2b8d38d012
2 changed files with 6 additions and 2 deletions

View file

@ -200,6 +200,7 @@ public:
typename rclcpp::client::Client<ServiceT>::SharedPtr typename rclcpp::client::Client<ServiceT>::SharedPtr
create_client( create_client(
const std::string & service_name, const std::string & service_name,
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_services_default,
rclcpp::callback_group::CallbackGroup::SharedPtr group = nullptr); rclcpp::callback_group::CallbackGroup::SharedPtr group = nullptr);
/* Create and return a Service. */ /* Create and return a Service. */
@ -208,6 +209,7 @@ public:
create_service( create_service(
const std::string & service_name, const std::string & service_name,
CallbackT && callback, CallbackT && callback,
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_services_default,
rclcpp::callback_group::CallbackGroup::SharedPtr group = nullptr); rclcpp::callback_group::CallbackGroup::SharedPtr group = nullptr);
RCLCPP_PUBLIC RCLCPP_PUBLIC

View file

@ -274,6 +274,7 @@ template<typename ServiceT>
typename client::Client<ServiceT>::SharedPtr typename client::Client<ServiceT>::SharedPtr
Node::create_client( Node::create_client(
const std::string & service_name, const std::string & service_name,
const rmw_qos_profile_t & qos_profile,
rclcpp::callback_group::CallbackGroup::SharedPtr group) rclcpp::callback_group::CallbackGroup::SharedPtr group)
{ {
using rosidl_generator_cpp::get_service_type_support_handle; using rosidl_generator_cpp::get_service_type_support_handle;
@ -281,7 +282,7 @@ Node::create_client(
get_service_type_support_handle<ServiceT>(); get_service_type_support_handle<ServiceT>();
rmw_client_t * client_handle = rmw_create_client( rmw_client_t * client_handle = rmw_create_client(
this->node_handle_.get(), service_type_support_handle, service_name.c_str()); this->node_handle_.get(), service_type_support_handle, service_name.c_str(), qos_profile);
if (!client_handle) { if (!client_handle) {
// *INDENT-OFF* (prevent uncrustify from making unecessary indents here) // *INDENT-OFF* (prevent uncrustify from making unecessary indents here)
throw std::runtime_error( throw std::runtime_error(
@ -318,6 +319,7 @@ typename rclcpp::service::Service<ServiceT>::SharedPtr
Node::create_service( Node::create_service(
const std::string & service_name, const std::string & service_name,
CallbackT && callback, CallbackT && callback,
const rmw_qos_profile_t & qos_profile,
rclcpp::callback_group::CallbackGroup::SharedPtr group) rclcpp::callback_group::CallbackGroup::SharedPtr group)
{ {
using rosidl_generator_cpp::get_service_type_support_handle; using rosidl_generator_cpp::get_service_type_support_handle;
@ -328,7 +330,7 @@ Node::create_service(
any_service_callback.set(std::forward<CallbackT>(callback)); any_service_callback.set(std::forward<CallbackT>(callback));
rmw_service_t * service_handle = rmw_create_service( rmw_service_t * service_handle = rmw_create_service(
node_handle_.get(), service_type_support_handle, service_name.c_str()); node_handle_.get(), service_type_support_handle, service_name.c_str(), qos_profile);
if (!service_handle) { if (!service_handle) {
// *INDENT-OFF* (prevent uncrustify from making unecessary indents here) // *INDENT-OFF* (prevent uncrustify from making unecessary indents here)
throw std::runtime_error( throw std::runtime_error(