ROS 2 rclcpp + rcl - jazzy
jazzy
ROS 2 C++ Client Library with ROS Client Library
|
Public Member Functions | |
Service (std::shared_ptr< rcl_node_t > node_handle, const std::string &service_name, AnyServiceCallback< ServiceT > any_callback, rcl_service_options_t &service_options) | |
Default constructor. More... | |
Service (std::shared_ptr< rcl_node_t > node_handle, std::shared_ptr< rcl_service_t > service_handle, AnyServiceCallback< ServiceT > any_callback) | |
Default constructor. More... | |
Service (std::shared_ptr< rcl_node_t > node_handle, rcl_service_t *service_handle, AnyServiceCallback< ServiceT > any_callback) | |
Default constructor. More... | |
bool | take_request (typename ServiceT::Request &request_out, rmw_request_id_t &request_id_out) |
Take the next request from the service. More... | |
std::shared_ptr< void > | create_request () override |
std::shared_ptr< rmw_request_id_t > | create_request_header () override |
void | handle_request (std::shared_ptr< rmw_request_id_t > request_header, std::shared_ptr< void > request) override |
void | send_response (rmw_request_id_t &req_id, typename ServiceT::Response &response) |
void | configure_introspection (Clock::SharedPtr clock, const QoS &qos_service_event_pub, rcl_service_introspection_state_t introspection_state) |
Configure service introspection. More... | |
![]() | |
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 | |
![]() | |
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) |
![]() | |
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 284 of file service.hpp.
|
inline |
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] | any_callback | User defined callback to call when a client request is received. |
[in] | service_options | options for the subscription. |
Definition at line 312 of file service.hpp.
References rclcpp::expand_topic_or_service_name(), rclcpp::ServiceBase::get_service_handle(), 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().
|
inline |
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_handle | service handle. |
[in] | any_callback | User defined callback to call when a client request is received. |
Definition at line 374 of file service.hpp.
References rclcpp::ServiceBase::get_service_handle(), and rcl_service_is_valid().
|
inline |
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_handle | service handle. |
[in] | any_callback | User defined callback to call when a client request is received. |
Definition at line 409 of file service.hpp.
References rclcpp::ServiceBase::get_service_handle(), rcl_service_s::impl, and rcl_service_is_valid().
|
inline |
Configure service introspection.
[in] | clock | clock to use to generate introspection timestamps |
[in] | qos_service_event_pub | QoS settings to use when creating the introspection publisher |
[in] | introspection_state | the state to set introspection to |
Definition at line 509 of file service.hpp.
References rclcpp::QoS::get_rmw_qos_profile(), rcl_publisher_options_s::qos, rcl_publisher_get_default_options(), RCL_RET_OK, and rcl_service_configure_service_introspection().
|
inline |
Take the next request from the service.
[out] | request_out | The reference to a service 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 455 of file service.hpp.
References rclcpp::ServiceBase::take_type_erased_request().