Class GenericService
Defined in File generic_service.hpp
Inheritance Relationships
Base Types
public rclcpp::ServiceBase
(Class ServiceBase)public std::enable_shared_from_this< GenericService >
Class Documentation
-
class GenericService : public rclcpp::ServiceBase, public std::enable_shared_from_this<GenericService>
Public Types
-
using Request = void*
-
using Response = void*
-
using CallbackType = std::function<void(const SharedRequest, SharedResponse)>
-
using CallbackWithHeaderType = std::function<void(const std::shared_ptr<rmw_request_id_t>, const SharedRequest, SharedResponse)>
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.
service_type – [in] The name of service type, e.g. “std_srvs/srv/SetBool”.
any_callback – [in] User defined callback to call when a client request is received.
service_options – [in] options for the service.
-
GenericService() = delete
-
inline virtual ~GenericService()
Take the next request from the service.
See also
- Parameters:
request_out – [out] The reference to a service deserialized 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.
-
virtual std::shared_ptr<void> create_request() override
-
std::shared_ptr<void> create_response()
-
virtual std::shared_ptr<rmw_request_id_t> create_request_header() override
-
using Request = void*