rmw  master
C API providing a middleware abstraction layer which is used to implement the rest of ROS.
rmw.h
Go to the documentation of this file.
1 // Copyright 2014-2017 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 
78 #ifndef RMW__RMW_H_
79 #define RMW__RMW_H_
80 
81 #ifdef __cplusplus
82 extern "C"
83 {
84 #endif
85 
86 #include <stdbool.h>
87 #include <stddef.h>
88 #include <stdint.h>
89 
90 #include "rcutils/types.h"
91 
92 #include "rosidl_generator_c/message_type_support_struct.h"
93 #include "rosidl_generator_c/service_type_support_struct.h"
94 
95 #include "rmw/init.h"
96 #include "rmw/macros.h"
97 #include "rmw/qos_profiles.h"
98 #include "rmw/types.h"
99 #include "rmw/visibility_control.h"
100 
103 const char *
105 
107 
120 const char *
122 
123 // TODO(wjwwood): refactor this API to return a return code when updated to use an allocator
125 
165 rmw_node_t *
167  rmw_context_t * context,
168  const char * name,
169  const char * namespace_,
170  size_t domain_id,
171  const rmw_node_security_options_t * security_options);
172 
174 
182 rmw_ret_t
184 
186 
214 const rmw_guard_condition_t *
216 
221  const rmw_node_t * node,
222  const rosidl_message_type_support_t * type_support,
223  const char * topic_name,
224  const rmw_qos_profile_t * qos_policies);
225 
228 rmw_ret_t
230 
233 rmw_ret_t
234 rmw_publish(const rmw_publisher_t * publisher, const void * ros_message);
235 
237 
249 rmw_ret_t
251  const rmw_publisher_t * publisher,
252  size_t * subscription_count);
253 
255 
269 rmw_ret_t
271  const rmw_publisher_t * publisher, const rmw_serialized_message_t * serialized_message);
272 
274 
288 rmw_ret_t
290  const void * ros_message,
291  const rosidl_message_type_support_t * type_support,
292  rmw_serialized_message_t * serialized_message);
293 
295 
312 rmw_ret_t
314  const rmw_serialized_message_t * serialized_message,
315  const rosidl_message_type_support_t * type_support,
316  void * ros_message);
317 
322  const rmw_node_t * node,
323  const rosidl_message_type_support_t * type_support,
324  const char * topic_name,
325  const rmw_qos_profile_t * qos_policies,
326  bool ignore_local_publications);
327 
330 rmw_ret_t
332 
334 
346 rmw_ret_t
348  const rmw_subscription_t * subscription,
349  size_t * publisher_count);
350 
353 rmw_ret_t
354 rmw_take(const rmw_subscription_t * subscription, void * ros_message, bool * taken);
355 
358 rmw_ret_t
360  const rmw_subscription_t * subscription,
361  void * ros_message,
362  bool * taken,
363  rmw_message_info_t * message_info);
364 
366 
383 rmw_ret_t
385  const rmw_subscription_t * subscription,
386  rmw_serialized_message_t * serialized_message,
387  bool * taken);
388 
390 
404 rmw_ret_t
406  const rmw_subscription_t * subscription,
407  rmw_serialized_message_t * serialized_message,
408  bool * taken,
409  rmw_message_info_t * message_info);
410 
413 rmw_client_t *
415  const rmw_node_t * node,
416  const rosidl_service_type_support_t * type_support,
417  const char * service_name,
418  const rmw_qos_profile_t * qos_policies);
419 
422 rmw_ret_t
423 rmw_destroy_client(rmw_node_t * node, rmw_client_t * client);
424 
427 rmw_ret_t
429  const rmw_client_t * client,
430  const void * ros_request,
431  int64_t * sequence_id);
432 
435 rmw_ret_t
437  const rmw_client_t * client,
438  rmw_request_id_t * request_header,
439  void * ros_response,
440  bool * taken);
441 
446  const rmw_node_t * node,
447  const rosidl_service_type_support_t * type_support,
448  const char * service_name,
449  const rmw_qos_profile_t * qos_policies);
450 
453 rmw_ret_t
454 rmw_destroy_service(rmw_node_t * node, rmw_service_t * service);
455 
458 rmw_ret_t
460  const rmw_service_t * service,
461  rmw_request_id_t * request_header,
462  void * ros_request,
463  bool * taken);
464 
467 rmw_ret_t
469  const rmw_service_t * service,
470  rmw_request_id_t * request_header,
471  void * ros_response);
472 
473 // TODO(wjwwood): refactor this API to return a return code when updated to use an allocator
475 
503 
504 
506 
514 rmw_ret_t
516 
519 rmw_ret_t
520 rmw_trigger_guard_condition(const rmw_guard_condition_t * guard_condition);
521 
523 
535 rmw_create_wait_set(size_t max_conditions);
536 
539 rmw_ret_t
541 
543 
578 rmw_ret_t
579 rmw_wait(
580  rmw_subscriptions_t * subscriptions,
581  rmw_guard_conditions_t * guard_conditions,
582  rmw_services_t * services,
583  rmw_clients_t * clients,
584  rmw_wait_set_t * wait_set,
585  const rmw_time_t * wait_timeout);
586 
588 
616 rmw_ret_t
618  const rmw_node_t * node,
619  rcutils_string_array_t * node_names,
620  rcutils_string_array_t * node_namespaces);
621 
624 rmw_ret_t
626  const rmw_node_t * node,
627  const char * topic_name,
628  size_t * count);
629 
632 rmw_ret_t
634  const rmw_node_t * node,
635  const char * topic_name,
636  size_t * count);
637 
640 rmw_ret_t
641 rmw_get_gid_for_publisher(const rmw_publisher_t * publisher, rmw_gid_t * gid);
642 
645 rmw_ret_t
646 rmw_compare_gids_equal(const rmw_gid_t * gid1, const rmw_gid_t * gid2, bool * result);
647 
649 
677 rmw_ret_t
679  const rmw_node_t * node,
680  const rmw_client_t * client,
681  bool * is_available);
682 
685 rmw_ret_t
687 
688 #ifdef __cplusplus
689 }
690 #endif
691 
692 #endif // RMW__RMW_H_
rmw_client_t * rmw_create_client(const rmw_node_t *node, const rosidl_service_type_support_t *type_support, const char *service_name, const rmw_qos_profile_t *qos_policies)
const rmw_guard_condition_t * rmw_node_get_graph_guard_condition(const rmw_node_t *node)
Return a guard condition which is triggered when the ROS graph changes.
rmw_ret_t rmw_set_log_severity(rmw_log_severity_t severity)
rmw_ret_t rmw_get_node_names(const rmw_node_t *node, rcutils_string_array_t *node_names, rcutils_string_array_t *node_namespaces)
Return a list of node name and namespaces discovered via a node.
rmw_ret_t rmw_get_gid_for_publisher(const rmw_publisher_t *publisher, rmw_gid_t *gid)
#define RMW_PUBLIC
Definition: visibility_control.h:48
Definition: types.h:222
rmw_guard_condition_t * rmw_create_guard_condition(rmw_context_t *context)
Create a guard condition and return a handle to that guard condition.
rmw_ret_t rmw_publish_serialized_message(const rmw_publisher_t *publisher, const rmw_serialized_message_t *serialized_message)
Publish an already serialized message.
Array of service handles.
Definition: types.h:105
rmw_ret_t rmw_publisher_count_matched_subscriptions(const rmw_publisher_t *publisher, size_t *subscription_count)
Retrieve the number of matched subscriptions to a publisher.
enum RWM_PUBLIC_TYPE rmw_log_severity_t
Array of subscriber handles.
Definition: types.h:90
#define RMW_WARN_UNUSED
Definition: macros.h:22
Definition: types.h:150
rmw_ret_t rmw_trigger_guard_condition(const rmw_guard_condition_t *guard_condition)
rmw_service_t * rmw_create_service(const rmw_node_t *node, const rosidl_service_type_support_t *type_support, const char *service_name, const rmw_qos_profile_t *qos_policies)
rmw_ret_t rmw_destroy_subscription(rmw_node_t *node, rmw_subscription_t *subscription)
const char * rmw_get_implementation_identifier(void)
rmw_subscription_t * rmw_create_subscription(const rmw_node_t *node, const rosidl_message_type_support_t *type_support, const char *topic_name, const rmw_qos_profile_t *qos_policies, bool ignore_local_publications)
rmw_ret_t rmw_destroy_client(rmw_node_t *node, rmw_client_t *client)
Definition: types.h:55
Initialization context structure which is used to store init specific information.
Definition: init.h:37
rmw_ret_t rmw_take_request(const rmw_service_t *service, rmw_request_id_t *request_header, void *ros_request, bool *taken)
rmw_ret_t rmw_count_subscribers(const rmw_node_t *node, const char *topic_name, size_t *count)
Definition: types.h:69
rmw_ret_t rmw_take_serialized_message(const rmw_subscription_t *subscription, rmw_serialized_message_t *serialized_message, bool *taken)
Take a message without deserializing it.
rmw_ret_t rmw_count_publishers(const rmw_node_t *node, const char *topic_name, size_t *count)
rmw_node_t * rmw_create_node(rmw_context_t *context, const char *name, const char *namespace_, size_t domain_id, const rmw_node_security_options_t *security_options)
Create a node and return a handle to that node.
rmw_ret_t rmw_destroy_service(rmw_node_t *node, rmw_service_t *service)
rmw_ret_t rmw_wait(rmw_subscriptions_t *subscriptions, rmw_guard_conditions_t *guard_conditions, rmw_services_t *services, rmw_clients_t *clients, rmw_wait_set_t *wait_set, const rmw_time_t *wait_timeout)
Waits on sets of different waitable entities and returns when one is ready.
Definition: types.h:216
rmw_ret_t rmw_take_response(const rmw_client_t *client, rmw_request_id_t *request_header, void *ros_response, bool *taken)
rmw_ret_t rmw_serialize(const void *ros_message, const rosidl_message_type_support_t *type_support, rmw_serialized_message_t *serialized_message)
Serialize a ROS message into a rmw_serialized_message_t.
rmw_ret_t rmw_destroy_wait_set(rmw_wait_set_t *wait_set)
rmw_publisher_t * rmw_create_publisher(const rmw_node_t *node, const rosidl_message_type_support_t *type_support, const char *topic_name, const rmw_qos_profile_t *qos_policies)
rmw_ret_t rmw_destroy_guard_condition(rmw_guard_condition_t *guard_condition)
Finalize a given guard condition handle, reclaim the resources, and deallocate the handle...
rmw_ret_t rmw_destroy_publisher(rmw_node_t *node, rmw_publisher_t *publisher)
Definition: types.h:143
rmw_ret_t rmw_destroy_node(rmw_node_t *node)
Finalize a given node handle, reclaim the resources, and deallocate the node handle.
rmw_ret_t rmw_take_serialized_message_with_info(const rmw_subscription_t *subscription, rmw_serialized_message_t *serialized_message, bool *taken, rmw_message_info_t *message_info)
Take a message without deserializing it and with its additional message information.
rmw_ret_t rmw_publish(const rmw_publisher_t *publisher, const void *ros_message)
Definition: types.h:156
rmw_ret_t rmw_deserialize(const rmw_serialized_message_t *serialized_message, const rosidl_message_type_support_t *type_support, void *ros_message)
Deserialize a ROS message.
int32_t rmw_ret_t
Definition: ret_types.h:25
const char * rmw_get_serialization_format(void)
Get the unique serialization format for this middleware.
Definition: types.h:76
Definition: types.h:62
Definition: types.h:168
Array of guard condition handles.
Definition: types.h:135
Definition: types.h:48
rmw_ret_t rmw_send_response(const rmw_service_t *service, rmw_request_id_t *request_header, void *ros_response)
rmw_ret_t rmw_take(const rmw_subscription_t *subscription, void *ros_message, bool *taken)
rmw_ret_t rmw_send_request(const rmw_client_t *client, const void *ros_request, int64_t *sequence_id)
Array of client handles.
Definition: types.h:120
rmw_ret_t rmw_subscription_count_matched_publishers(const rmw_subscription_t *subscription, size_t *publisher_count)
Retrieve the number of matched publishers to a subscription.
rmw_ret_t rmw_take_with_info(const rmw_subscription_t *subscription, void *ros_message, bool *taken, rmw_message_info_t *message_info)
rmw_ret_t rmw_service_server_is_available(const rmw_node_t *node, const rmw_client_t *client, bool *is_available)
Check if a service server is available for the given service client.
rmw_ret_t rmw_compare_gids_equal(const rmw_gid_t *gid1, const rmw_gid_t *gid2, bool *result)
ROS MiddleWare quality of service profile.
Definition: types.h:196
Definition: types.h:39
rmw_wait_set_t * rmw_create_wait_set(size_t max_conditions)
Create a wait set to store conditions that the middleware will block on.