@@ -117,6 +117,28 @@ class Node : public rclcpp::Node {
117117 return action_server;
118118 }
119119
120+ template <typename ServiceT>
121+ typename rclcpp::Client<ServiceT>::SharedPtr
122+ create_client (const std::string &service_name,
123+ const rmw_qos_profile_t &qos_profile) {
124+ return rclcpp::create_client<ServiceT>(
125+ node_base_, node_graph_, node_services_,
126+ rclcpp::extend_name_with_sub_namespace (service_name,
127+ this ->get_sub_namespace ()),
128+ qos_profile, this ->group );
129+ }
130+
131+ template <typename ServiceT, typename CallbackT>
132+ typename rclcpp::Service<ServiceT>::SharedPtr
133+ create_service (const std::string &service_name, CallbackT &&callback,
134+ const rmw_qos_profile_t &qos_profile) {
135+ return rclcpp::create_service<ServiceT, CallbackT>(
136+ node_base_, node_services_,
137+ rclcpp::extend_name_with_sub_namespace (service_name,
138+ this ->get_sub_namespace ()),
139+ std::forward<CallbackT>(callback), qos_profile, this ->group );
140+ }
141+
120142private:
121143 rclcpp::CallbackGroup::SharedPtr group;
122144 rclcpp::Executor *executor;
0 commit comments