|
ROS 2 rclcpp + rcl - rolling
rolling-4d14414d
ROS 2 C++ Client Library with ROS Client Library
|


Public Member Functions | |
| RCLCPP_PUBLIC | GenericService (std::shared_ptr< rcl_node_t > node_handle, const std::string &service_name, const std::string &service_type, GenericServiceCallback any_callback, rcl_service_options_t &service_options) |
| Default constructor. More... | |
| RCLCPP_PUBLIC bool | take_request (SharedRequest request_out, rmw_request_id_t &request_id_out) |
| Take the next request from the service. More... | |
| RCLCPP_PUBLIC std::shared_ptr< void > | create_request () override |
| RCLCPP_PUBLIC std::shared_ptr< void > | create_response () |
| RCLCPP_PUBLIC std::shared_ptr< rmw_request_id_t > | create_request_header () override |
| RCLCPP_PUBLIC void | handle_request (std::shared_ptr< rmw_request_id_t > request_header, std::shared_ptr< void > request) override |
| RCLCPP_PUBLIC void | send_response (rmw_request_id_t &req_id, SharedResponse &response) |
Public Member Functions inherited from rclcpp::ServiceBase | |
| RCLCPP_PUBLIC | ServiceBase (std::shared_ptr< rcl_node_t > node_handle) |
| RCLCPP_PUBLIC const char * | get_service_name () |
| Return the name of the service. More... | |
| RCLCPP_PUBLIC std::shared_ptr< rcl_service_t > | get_service_handle () |
| Return the rcl_service_t service handle in a std::shared_ptr. More... | |
| RCLCPP_PUBLIC std::shared_ptr< const rcl_service_t > | get_service_handle () const |
| Return the rcl_service_t service handle in a std::shared_ptr. More... | |
| RCLCPP_PUBLIC bool | take_type_erased_request (void *request_out, rmw_request_id_t &request_id_out) |
| Take the next request from the service as a type erased pointer. More... | |
| RCLCPP_PUBLIC bool | exchange_in_use_by_wait_set_state (bool in_use_state) |
| Exchange the "in use by wait set" state for this service. More... | |
| RCLCPP_PUBLIC rclcpp::QoS | get_response_publisher_actual_qos () const |
| Get the actual response publisher QoS settings, after the defaults have been determined. More... | |
| RCLCPP_PUBLIC rclcpp::QoS | get_request_subscription_actual_qos () const |
| Get the actual request subscription QoS settings, after the defaults have been determined. More... | |
| void | set_on_new_request_callback (std::function< void(size_t)> callback) |
| Set a callback to be called when each new request is received. More... | |
| void | clear_on_new_request_callback () |
| Unset the callback registered for new requests, if any. | |
Additional Inherited Members | |
Protected Member Functions inherited from rclcpp::ServiceBase | |
| RCLCPP_PUBLIC rcl_node_t * | get_rcl_node_handle () |
| RCLCPP_PUBLIC const rcl_node_t * | get_rcl_node_handle () const |
| RCLCPP_PUBLIC void | set_on_new_request_callback (rcl_event_callback_t callback, const void *user_data) |
Protected Attributes inherited from rclcpp::ServiceBase | |
| std::shared_ptr< rcl_node_t > | node_handle_ |
| std::recursive_mutex | callback_mutex_ |
| std::function< void(size_t)> | on_new_request_callback_ {nullptr} |
| std::shared_ptr< rcl_service_t > | service_handle_ |
| bool | owns_rcl_handle_ = true |
| rclcpp::Logger | node_logger_ |
| std::atomic< bool > | in_use_by_wait_set_ {false} |
Definition at line 216 of file generic_service.hpp.
| rclcpp::GenericService::GenericService | ( | std::shared_ptr< rcl_node_t > | node_handle, |
| const std::string & | service_name, | ||
| const std::string & | service_type, | ||
| GenericServiceCallback | any_callback, | ||
| rcl_service_options_t & | service_options | ||
| ) |
Default constructor.
The constructor for a Service is almost never called directly. Instead, services should be instantiated through the function rclcpp::create_service().
| [in] | node_handle | NodeBaseInterface pointer that is used in part of the setup. |
| [in] | service_name | Name of the topic to publish to. |
| [in] | service_type | The name of service type, e.g. "std_srvs/srv/SetBool". |
| [in] | any_callback | User defined callback to call when a client request is received. |
| [in] | service_options | options for the service. |
Definition at line 19 of file generic_service.cpp.
References rclcpp::expand_topic_or_service_name(), rclcpp::Logger::get_child(), rclcpp::get_message_typesupport_handle(), rclcpp::get_node_logger(), rclcpp::ServiceBase::get_service_handle(), rclcpp::get_service_typesupport_handle(), rclcpp::get_typesupport_library(), rcl_get_zero_initialized_service(), rcl_node_get_name(), rcl_node_get_namespace(), RCL_RET_OK, RCL_RET_SERVICE_NAME_INVALID, rcl_service_fini(), and rcl_service_init().

| bool rclcpp::GenericService::take_request | ( | SharedRequest | request_out, |
| rmw_request_id_t & | request_id_out | ||
| ) |
Take the next request from the service.
| [out] | request_out | The reference to a service deserialized request object into which the middleware will copy the taken request. |
| [out] | request_id_out | The output id for the request which can be used to associate response with this request in the future. |
| rclcpp::exceptions::RCLError | based exceptions if the underlying rcl calls fail. |
Definition at line 100 of file generic_service.cpp.
References rclcpp::ServiceBase::take_type_erased_request().
