Template Class Service
Defined in File service.hpp
Inheritance Relationships
Base Types
public rclcpp::ServiceBase
(Class ServiceBase)public std::enable_shared_from_this< Service< ServiceT > >
Class Documentation
-
template<typename ServiceT>
class Service : public rclcpp::ServiceBase, public std::enable_shared_from_this<Service<ServiceT>> Public Types
Public Functions
Default constructor.
The constructor for a Service is almost never called directly. Instead, services should be instantiated through the function rclcpp::create_service().
- Parameters:
node_handle – [in] NodeBaseInterface pointer that is used in part of the setup.
service_name – [in] Name of the topic to publish to.
any_callback – [in] User defined callback to call when a client request is received.
service_options – [in] options for the service.
Default constructor.
The constructor for a Service is almost never called directly. Instead, services should be instantiated through the function rclcpp::create_service().
- Parameters:
node_handle – [in] NodeBaseInterface pointer that is used in part of the setup.
service_handle – [in] service handle.
any_callback – [in] User defined callback to call when a client request is received.
Default constructor.
The constructor for a Service is almost never called directly. Instead, services should be instantiated through the function rclcpp::create_service().
- Parameters:
node_handle – [in] NodeBaseInterface pointer that is used in part of the setup.
service_handle – [in] service handle.
any_callback – [in] User defined callback to call when a client request is received.
-
Service() = delete
-
inline virtual ~Service()
-
inline bool take_request(typename ServiceT::Request &request_out, rmw_request_id_t &request_id_out)
Take the next request from the service.
See also
- Parameters:
request_out – [out] The reference to a service request object into which the middleware will copy the taken request.
request_id_out – [out] The output id for the request which can be used to associate response with this request in the future.
- Throws:
rclcpp::exceptions::RCLError – based exceptions if the underlying rcl calls fail.
- Returns:
true if the request was taken, otherwise false.
-
inline virtual std::shared_ptr<void> create_request() override
-
inline virtual std::shared_ptr<rmw_request_id_t> create_request_header() override
Configure service introspection.
- Parameters:
clock – [in] clock to use to generate introspection timestamps
qos_service_event_pub – [in] QoS settings to use when creating the introspection publisher
introspection_state – [in] the state to set introspection to