ROS 2 rclcpp + rcl - rolling  rolling-a919a6e5
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/allocator.h"
28 #include "rcl/event_callback.h"
29 #include "rcl/macros.h"
30 #include "rcl/node.h"
31 #include "rcl/publisher.h"
32 #include "rcl/service_introspection.h"
33 #include "rcl/time.h"
34 #include "rcl/visibility_control.h"
35 
36 #include "rmw/types.h"
37 
40 
42 typedef struct rcl_client_s
43 {
47 
49 typedef struct rcl_client_options_s
50 {
52  rmw_qos_profile_t qos;
54 
57 
59 
63 RCL_PUBLIC
64 RCL_WARN_UNUSED
67 
69 
162 RCL_PUBLIC
163 RCL_WARN_UNUSED
164 rcl_ret_t
166  rcl_client_t * client,
167  const rcl_node_t * node,
168  const rosidl_service_type_support_t * type_support,
169  const char * service_name,
170  const rcl_client_options_t * options);
171 
173 
193 RCL_PUBLIC
194 RCL_WARN_UNUSED
195 rcl_ret_t
196 rcl_client_fini(rcl_client_t * client, rcl_node_t * node);
197 
199 
205 RCL_PUBLIC
206 RCL_WARN_UNUSED
209 
211 
254 RCL_PUBLIC
255 RCL_WARN_UNUSED
256 rcl_ret_t
257 rcl_send_request(const rcl_client_t * client, const void * ros_request, int64_t * sequence_number);
258 
259 
261 
295 RCL_PUBLIC
296 RCL_WARN_UNUSED
297 rcl_ret_t
299  const rcl_client_t * client,
300  rmw_service_info_t * request_header,
301  void * ros_response);
302 
304 RCL_PUBLIC
305 RCL_WARN_UNUSED
306 rcl_ret_t
308  const rcl_client_t * client,
309  rmw_request_id_t * request_header,
310  void * ros_response);
311 
313 
334 RCL_PUBLIC
335 RCL_WARN_UNUSED
336 const char *
338 
340 
361 RCL_PUBLIC
362 RCL_WARN_UNUSED
363 const rcl_client_options_t *
364 rcl_client_get_options(const rcl_client_t * client);
365 
367 
392 RCL_PUBLIC
393 RCL_WARN_UNUSED
394 rmw_client_t *
396 
398 
415 RCL_PUBLIC
416 bool
417 rcl_client_is_valid(const rcl_client_t * client);
418 
420 
440 RCL_PUBLIC
441 RCL_WARN_UNUSED
442 const rmw_qos_profile_t *
444 
446 
466 RCL_PUBLIC
467 RCL_WARN_UNUSED
468 const rmw_qos_profile_t *
470 
472 
494 RCL_PUBLIC
495 RCL_WARN_UNUSED
496 rcl_ret_t
498  const rcl_client_t * client,
499  rcl_event_callback_t callback,
500  const void * user_data);
501 
503 
533 RCL_PUBLIC
534 RCL_WARN_UNUSED
535 rcl_ret_t
537  rcl_client_t * client,
538  rcl_node_t * node,
539  rcl_clock_t * clock,
540  const rosidl_service_type_support_t * type_support,
541  const rcl_publisher_options_t publisher_options,
542  rcl_service_introspection_state_t introspection_state);
543 
544 #ifdef __cplusplus
545 }
546 #endif
547 
548 #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:357
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:466
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:431
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:291
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:229
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:87
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:280
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:309
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:56
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:407
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:449
RCL_PUBLIC bool rcl_client_is_valid(const rcl_client_t *client)
Check that the client is valid.
Definition: client.c:420
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:318
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:440
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:300
Options available for a rcl_client_t.
Definition: client.h:50
rcl_allocator_t allocator
Custom allocator for the client, used for incidental allocations.
Definition: client.h:55
rmw_qos_profile_t qos
Middleware quality of service settings for the client.
Definition: client.h:52
Structure which encapsulates a ROS Client.
Definition: client.h:43
rcl_client_impl_t * impl
Pointer to the client implementation.
Definition: client.h:45
Encapsulation of a time source.
Definition: time.h:138
Structure which encapsulates a ROS Node.
Definition: node.h:45
Options available for a rcl publisher.
Definition: publisher.h:44
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:24