ROS 2 rclcpp + rcl - rolling  rolling-e7363f10
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 <stdbool.h>
26 #include <stdint.h>
27 
28 #include "rosidl_runtime_c/service_type_support_struct.h"
29 
30 #include "rcl/allocator.h"
31 #include "rcl/event_callback.h"
32 #include "rcl/macros.h"
33 #include "rcl/node.h"
34 #include "rcl/publisher.h"
35 #include "rcl/service_introspection.h"
36 #include "rcl/time.h"
37 #include "rcl/types.h"
38 #include "rcl/visibility_control.h"
39 
40 #include "rmw/types.h"
41 
44 
46 typedef struct rcl_client_s
47 {
51 
53 typedef struct rcl_client_options_s
54 {
56  rmw_qos_profile_t qos;
58 
61 
63 
67 RCL_PUBLIC
68 RCL_WARN_UNUSED
71 
73 
166 RCL_PUBLIC
167 RCL_WARN_UNUSED
168 rcl_ret_t
170  rcl_client_t * client,
171  const rcl_node_t * node,
172  const rosidl_service_type_support_t * type_support,
173  const char * service_name,
174  const rcl_client_options_t * options);
175 
177 
197 RCL_PUBLIC
198 RCL_WARN_UNUSED
199 rcl_ret_t
200 rcl_client_fini(rcl_client_t * client, rcl_node_t * node);
201 
203 
209 RCL_PUBLIC
210 RCL_WARN_UNUSED
213 
215 
258 RCL_PUBLIC
259 RCL_WARN_UNUSED
260 rcl_ret_t
261 rcl_send_request(const rcl_client_t * client, const void * ros_request, int64_t * sequence_number);
262 
263 
265 
299 RCL_PUBLIC
300 RCL_WARN_UNUSED
301 rcl_ret_t
303  const rcl_client_t * client,
304  rmw_service_info_t * request_header,
305  void * ros_response);
306 
308 RCL_PUBLIC
309 RCL_WARN_UNUSED
310 rcl_ret_t
312  const rcl_client_t * client,
313  rmw_request_id_t * request_header,
314  void * ros_response);
315 
317 
338 RCL_PUBLIC
339 RCL_WARN_UNUSED
340 const char *
342 
344 
365 RCL_PUBLIC
366 RCL_WARN_UNUSED
367 const rcl_client_options_t *
368 rcl_client_get_options(const rcl_client_t * client);
369 
371 
396 RCL_PUBLIC
397 RCL_WARN_UNUSED
398 rmw_client_t *
400 
402 
419 RCL_PUBLIC
420 bool
421 rcl_client_is_valid(const rcl_client_t * client);
422 
424 
444 RCL_PUBLIC
445 RCL_WARN_UNUSED
446 const rmw_qos_profile_t *
448 
450 
470 RCL_PUBLIC
471 RCL_WARN_UNUSED
472 const rmw_qos_profile_t *
474 
476 
509 RCL_PUBLIC
510 RCL_WARN_UNUSED
511 rcl_ret_t
513  const rcl_client_t * client,
514  rcl_event_callback_t callback,
515  const void * user_data);
516 
518 
548 RCL_PUBLIC
549 RCL_WARN_UNUSED
550 rcl_ret_t
552  rcl_client_t * client,
553  rcl_node_t * node,
554  rcl_clock_t * clock,
555  const rosidl_service_type_support_t * type_support,
556  const rcl_publisher_options_t publisher_options,
557  rcl_service_introspection_state_t introspection_state);
558 
559 #ifdef __cplusplus
560 }
561 #endif
562 
563 #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:354
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_client_configure_service_introspection(rcl_client_t *client, rcl_node_t *node, rcl_clock_t *clock, const rosidl_service_type_support_t *type_support, const rcl_publisher_options_t publisher_options, rcl_service_introspection_state_t introspection_state)
Configures service introspection features for the client.
Definition: client.c:463
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:428
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:288
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:226
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:83
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:277
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:306
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:52
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:404
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:446
RCL_PUBLIC bool rcl_client_is_valid(const rcl_client_t *client)
Check that the client is valid.
Definition: client.c:417
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:315
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:437
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:297
Options available for a rcl_client_t.
Definition: client.h:54
rcl_allocator_t allocator
Custom allocator for the client, used for incidental allocations.
Definition: client.h:59
rmw_qos_profile_t qos
Middleware quality of service settings for the client.
Definition: client.h:56
Structure which encapsulates a ROS Client.
Definition: client.h:47
rcl_client_impl_t * impl
Pointer to the client implementation.
Definition: client.h:49
Encapsulation of a time source.
Definition: time.h:141
Structure which encapsulates a ROS Node.
Definition: node.h:49
Options available for a rcl publisher.
Definition: publisher.h:51
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:25