ROS 2 rclcpp + rcl - humble  humble
ROS 2 C++ Client Library with ROS Client Library
client.h
Go to the documentation of this file.
1 // Copyright 2016 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
16 
17 #ifndef RCL__CLIENT_H_
18 #define RCL__CLIENT_H_
19 
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include "rosidl_runtime_c/service_type_support_struct.h"
26 
27 #include "rcl/event_callback.h"
28 #include "rcl/macros.h"
29 #include "rcl/node.h"
30 #include "rcl/visibility_control.h"
31 
34 
36 typedef struct rcl_client_s
37 {
41 
43 typedef struct rcl_client_options_s
44 {
46  rmw_qos_profile_t qos;
48 
51 
53 
57 RCL_PUBLIC
58 RCL_WARN_UNUSED
61 
63 
156 RCL_PUBLIC
157 RCL_WARN_UNUSED
158 rcl_ret_t
160  rcl_client_t * client,
161  const rcl_node_t * node,
162  const rosidl_service_type_support_t * type_support,
163  const char * service_name,
164  const rcl_client_options_t * options);
165 
167 
187 RCL_PUBLIC
188 RCL_WARN_UNUSED
189 rcl_ret_t
190 rcl_client_fini(rcl_client_t * client, rcl_node_t * node);
191 
193 
199 RCL_PUBLIC
200 RCL_WARN_UNUSED
203 
205 
248 RCL_PUBLIC
249 RCL_WARN_UNUSED
250 rcl_ret_t
251 rcl_send_request(const rcl_client_t * client, const void * ros_request, int64_t * sequence_number);
252 
253 
255 
289 RCL_PUBLIC
290 RCL_WARN_UNUSED
291 rcl_ret_t
293  const rcl_client_t * client,
294  rmw_service_info_t * request_header,
295  void * ros_response);
296 
298 RCL_PUBLIC
299 RCL_WARN_UNUSED
300 rcl_ret_t
302  const rcl_client_t * client,
303  rmw_request_id_t * request_header,
304  void * ros_response);
305 
307 
328 RCL_PUBLIC
329 RCL_WARN_UNUSED
330 const char *
332 
334 
355 RCL_PUBLIC
356 RCL_WARN_UNUSED
357 const rcl_client_options_t *
358 rcl_client_get_options(const rcl_client_t * client);
359 
361 
386 RCL_PUBLIC
387 RCL_WARN_UNUSED
388 rmw_client_t *
390 
392 
409 RCL_PUBLIC
410 bool
411 rcl_client_is_valid(const rcl_client_t * client);
412 
414 
434 RCL_PUBLIC
435 RCL_WARN_UNUSED
436 const rmw_qos_profile_t *
438 
440 
460 RCL_PUBLIC
461 RCL_WARN_UNUSED
462 const rmw_qos_profile_t *
464 
466 
488 RCL_PUBLIC
489 RCL_WARN_UNUSED
490 rcl_ret_t
492  const rcl_client_t * client,
493  rcl_event_callback_t callback,
494  const void * user_data);
495 
496 #ifdef __cplusplus
497 }
498 #endif
499 
500 #endif // RCL__CLIENT_H_
rcutils_allocator_t rcl_allocator_t
Encapsulation of an allocator.
Definition: allocator.h:31
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_take_response_with_info(const rcl_client_t *client, rmw_service_info_t *request_header, void *ros_response)
Take a ROS response using a client.
Definition: client.c:259
RCL_PUBLIC RCL_WARN_UNUSED const rmw_qos_profile_t * rcl_client_request_publisher_get_actual_qos(const rcl_client_t *client)
Get the actual qos settings of the client's request publisher.
Definition: client.c:314
RCL_PUBLIC RCL_WARN_UNUSED const char * rcl_client_get_service_name(const rcl_client_t *client)
Get the name of the service that this client will request a response from.
Definition: client.c:210
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_client_fini(rcl_client_t *client, rcl_node_t *node)
Finalize a rcl_client_t.
Definition: client.c:168
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_client_init(rcl_client_t *client, const rcl_node_t *node, const rosidl_service_type_support_t *type_support, const char *service_name, const rcl_client_options_t *options)
Initialize a rcl client.
Definition: client.c:53
RCL_PUBLIC RCL_WARN_UNUSED rcl_client_options_t rcl_client_get_default_options(void)
Return the default client options in a rcl_client_options_t.
Definition: client.c:199
struct rcl_client_options_s rcl_client_options_t
Options available for a rcl_client_t.
RCL_PUBLIC RCL_WARN_UNUSED rmw_client_t * rcl_client_get_rmw_handle(const rcl_client_t *client)
Return the rmw client handle.
Definition: client.c:230
RCL_PUBLIC RCL_WARN_UNUSED rcl_client_t rcl_get_zero_initialized_client(void)
Return a rcl_client_t struct with members set to NULL.
Definition: client.c:46
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_take_response(const rcl_client_t *client, rmw_request_id_t *request_header, void *ros_response)
backwards compatibility function that takes a rmw_request_id_t only
Definition: client.c:290
struct rcl_client_s rcl_client_t
Structure which encapsulates a ROS Client.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_client_set_on_new_response_callback(const rcl_client_t *client, rcl_event_callback_t callback, const void *user_data)
Set the on new response callback function for the client.
Definition: client.c:332
RCL_PUBLIC bool rcl_client_is_valid(const rcl_client_t *client)
Check that the client is valid.
Definition: client.c:303
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_send_request(const rcl_client_t *client, const void *ros_request, int64_t *sequence_number)
Send a ROS request using a client.
Definition: client.c:239
RCL_PUBLIC RCL_WARN_UNUSED const rmw_qos_profile_t * rcl_client_response_subscription_get_actual_qos(const rcl_client_t *client)
Get the actual qos settings of the client's response subscription.
Definition: client.c:323
RCL_PUBLIC RCL_WARN_UNUSED const rcl_client_options_t * rcl_client_get_options(const rcl_client_t *client)
Return the rcl client options.
Definition: client.c:221
Options available for a rcl_client_t.
Definition: client.h:44
rcl_allocator_t allocator
Custom allocator for the client, used for incidental allocations.
Definition: client.h:49
rmw_qos_profile_t qos
Middleware quality of service settings for the client.
Definition: client.h:46
Structure which encapsulates a ROS Client.
Definition: client.h:37
rcl_client_impl_t * impl
Pointer to the client implementation.
Definition: client.h:39
Structure which encapsulates a ROS Node.
Definition: node.h:42
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:23