Template Function rclcpp::create_generic_service(NodeT, const std::string&, const std::string&, CallbackT&&, const rclcpp::QoS&, rclcpp::CallbackGroup::SharedPtr)

Function Documentation

template<typename NodeT, typename CallbackT>
rclcpp::GenericService::SharedPtr rclcpp::create_generic_service(NodeT node, const std::string &service_name, const std::string &service_type, CallbackT &&callback, const rclcpp::QoS &qos, rclcpp::CallbackGroup::SharedPtr group)

Create a generic service with a given type.

The NodeT type needs to have NodeBaseInterface implementation and NodeServicesInterface implementation of the node which to create the generic service.

Parameters:
  • node[in] The node on which to create the generic service.

  • service_name[in] The name on which the service is accessible.

  • service_type[in] The name of service type, e.g. “std_srvs/srv/SetBool”.

  • callback[in] The callback to call when the service gets a request.

  • qos[in] Quality of service profile for the service.

  • group[in] Callback group to handle the reply to service calls.

Returns:

Shared pointer to the created service.