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_bounds_struct.h"
93 #include "rosidl_generator_c/message_type_support_struct.h"
94 #include "rosidl_generator_c/service_type_support_struct.h"
95 
96 #include "rmw/init.h"
97 #include "rmw/macros.h"
98 #include "rmw/qos_profiles.h"
99 #include "rmw/types.h"
100 #include "rmw/visibility_control.h"
101 
104 const char *
106 
108 
121 const char *
123 
124 // TODO(wjwwood): refactor this API to return a return code when updated to use an allocator
126 
166 rmw_node_t *
168  rmw_context_t * context,
169  const char * name,
170  const char * namespace_,
171  size_t domain_id,
172  const rmw_node_security_options_t * security_options);
173 
175 
183 rmw_ret_t
185 
187 
207 rmw_ret_t
209 
211 
239 const rmw_guard_condition_t *
241 
243 
261 rmw_ret_t
263  const rosidl_message_type_support_t * type_support,
264  const rosidl_message_bounds_t * message_bounds,
265  rmw_publisher_allocation_t * allocation);
266 
268 
278 rmw_ret_t
280  rmw_publisher_allocation_t * allocation);
281 
286  const rmw_node_t * node,
287  const rosidl_message_type_support_t * type_support,
288  const char * topic_name,
289  const rmw_qos_profile_t * qos_policies);
290 
293 rmw_ret_t
295 
297 
309 rmw_ret_t
311  const rmw_publisher_t * publisher,
312  const void * ros_message,
313  rmw_publisher_allocation_t * allocation);
314 
316 
328 rmw_ret_t
330  const rmw_publisher_t * publisher,
331  size_t * subscription_count);
332 
334 
354 rmw_ret_t
356  const rmw_publisher_t * publisher,
357  rmw_qos_profile_t * qos);
358 
360 
375 rmw_ret_t
377  const rmw_publisher_t * publisher,
378  const rmw_serialized_message_t * serialized_message,
379  rmw_publisher_allocation_t * allocation);
380 
382 
394 rmw_ret_t
396  const rosidl_message_type_support_t * type_support,
397  const rosidl_message_bounds_t * message_bounds,
398  size_t * size);
399 
401 
421 rmw_ret_t
423 
425 
439 rmw_ret_t
441  const void * ros_message,
442  const rosidl_message_type_support_t * type_support,
443  rmw_serialized_message_t * serialized_message);
444 
446 
463 rmw_ret_t
465  const rmw_serialized_message_t * serialized_message,
466  const rosidl_message_type_support_t * type_support,
467  void * ros_message);
468 
470 
488 rmw_ret_t
490  const rosidl_message_type_support_t * type_support,
491  const rosidl_message_bounds_t * message_bounds,
492  rmw_subscription_allocation_t * allocation);
493 
495 
505 rmw_ret_t
507  rmw_subscription_allocation_t * allocation);
508 
513  const rmw_node_t * node,
514  const rosidl_message_type_support_t * type_support,
515  const char * topic_name,
516  const rmw_qos_profile_t * qos_policies,
517  bool ignore_local_publications);
518 
521 rmw_ret_t
523 
525 
537 rmw_ret_t
539  const rmw_subscription_t * subscription,
540  size_t * publisher_count);
541 
543 
555 rmw_ret_t
556 rmw_take(
557  const rmw_subscription_t * subscription,
558  void * ros_message,
559  bool * taken,
560  rmw_subscription_allocation_t * allocation);
561 
563 
576 rmw_ret_t
578  const rmw_subscription_t * subscription,
579  void * ros_message,
580  bool * taken,
581  rmw_message_info_t * message_info,
582  rmw_subscription_allocation_t * allocation);
583 
585 
603 rmw_ret_t
605  const rmw_subscription_t * subscription,
606  rmw_serialized_message_t * serialized_message,
607  bool * taken,
608  rmw_subscription_allocation_t * allocation);
609 
611 
626 rmw_ret_t
628  const rmw_subscription_t * subscription,
629  rmw_serialized_message_t * serialized_message,
630  bool * taken,
631  rmw_message_info_t * message_info,
632  rmw_subscription_allocation_t * allocation);
633 
636 rmw_client_t *
638  const rmw_node_t * node,
639  const rosidl_service_type_support_t * type_support,
640  const char * service_name,
641  const rmw_qos_profile_t * qos_policies);
642 
645 rmw_ret_t
646 rmw_destroy_client(rmw_node_t * node, rmw_client_t * client);
647 
650 rmw_ret_t
652  const rmw_client_t * client,
653  const void * ros_request,
654  int64_t * sequence_id);
655 
658 rmw_ret_t
660  const rmw_client_t * client,
661  rmw_request_id_t * request_header,
662  void * ros_response,
663  bool * taken);
664 
669  const rmw_node_t * node,
670  const rosidl_service_type_support_t * type_support,
671  const char * service_name,
672  const rmw_qos_profile_t * qos_policies);
673 
676 rmw_ret_t
677 rmw_destroy_service(rmw_node_t * node, rmw_service_t * service);
678 
681 rmw_ret_t
683  const rmw_service_t * service,
684  rmw_request_id_t * request_header,
685  void * ros_request,
686  bool * taken);
687 
690 rmw_ret_t
692  const rmw_service_t * service,
693  rmw_request_id_t * request_header,
694  void * ros_response);
695 
696 // TODO(wjwwood): refactor this API to return a return code when updated to use an allocator
698 
726 
727 
729 
737 rmw_ret_t
739 
742 rmw_ret_t
743 rmw_trigger_guard_condition(const rmw_guard_condition_t * guard_condition);
744 
746 
766 rmw_create_wait_set(rmw_context_t * context, size_t max_conditions);
767 
770 rmw_ret_t
772 
774 
809 rmw_ret_t
810 rmw_wait(
811  rmw_subscriptions_t * subscriptions,
812  rmw_guard_conditions_t * guard_conditions,
813  rmw_services_t * services,
814  rmw_clients_t * clients,
815  rmw_events_t * events,
816  rmw_wait_set_t * wait_set,
817  const rmw_time_t * wait_timeout);
818 
820 
848 rmw_ret_t
850  const rmw_node_t * node,
851  rcutils_string_array_t * node_names,
852  rcutils_string_array_t * node_namespaces);
853 
856 rmw_ret_t
858  const rmw_node_t * node,
859  const char * topic_name,
860  size_t * count);
861 
864 rmw_ret_t
866  const rmw_node_t * node,
867  const char * topic_name,
868  size_t * count);
869 
872 rmw_ret_t
873 rmw_get_gid_for_publisher(const rmw_publisher_t * publisher, rmw_gid_t * gid);
874 
877 rmw_ret_t
878 rmw_compare_gids_equal(const rmw_gid_t * gid1, const rmw_gid_t * gid2, bool * result);
879 
881 
909 rmw_ret_t
911  const rmw_node_t * node,
912  const rmw_client_t * client,
913  bool * is_available);
914 
917 rmw_ret_t
919 
920 #ifdef __cplusplus
921 }
922 #endif
923 
924 #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_publish(const rmw_publisher_t *publisher, const void *ros_message, rmw_publisher_allocation_t *allocation)
Publish a given ros_message.
rmw_ret_t rmw_get_gid_for_publisher(const rmw_publisher_t *publisher, rmw_gid_t *gid)
rmw_ret_t rmw_publisher_assert_liveliness(const rmw_publisher_t *publisher)
Manually assert that this Publisher is alive (for RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC) ...
rmw_ret_t rmw_take_serialized_message(const rmw_subscription_t *subscription, rmw_serialized_message_t *serialized_message, bool *taken, rmw_subscription_allocation_t *allocation)
Take a message without deserializing it.
#define RMW_PUBLIC
Definition: visibility_control.h:48
Definition: types.h:268
rmw_guard_condition_t * rmw_create_guard_condition(rmw_context_t *context)
Create a guard condition and return a handle to that guard condition.
Array of service handles.
Definition: types.h:117
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.
Array of subscriber handles.
Definition: types.h:102
#define RMW_WARN_UNUSED
Definition: macros.h:22
Definition: types.h:170
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)
rmw_ret_t rmw_publish_serialized_message(const rmw_publisher_t *publisher, const rmw_serialized_message_t *serialized_message, rmw_publisher_allocation_t *allocation)
Publish an already serialized message.
rmw_ret_t rmw_publisher_get_actual_qos(const rmw_publisher_t *publisher, rmw_qos_profile_t *qos)
Retrieve the actual qos settings of the publisher.
enum RMW_PUBLIC_TYPE rmw_log_severity_t
Type mapping of rcutils log severity types to rmw specific types.
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)
Definition: types.h:89
rmw_ret_t rmw_fini_subscription_allocation(rmw_subscription_allocation_t *allocation)
Destroy a publisher allocation object.
rmw_ret_t rmw_destroy_client(rmw_node_t *node, rmw_client_t *client)
rmw_ret_t rmw_fini_publisher_allocation(rmw_publisher_allocation_t *allocation)
Destroy a publisher allocation object.
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)
rmw_ret_t rmw_take_with_info(const rmw_subscription_t *subscription, void *ros_message, bool *taken, rmw_message_info_t *message_info, rmw_subscription_allocation_t *allocation)
Take an incoming message from a subscription with additional metadata.
Definition: types.h:69
rmw_ret_t rmw_wait(rmw_subscriptions_t *subscriptions, rmw_guard_conditions_t *guard_conditions, rmw_services_t *services, rmw_clients_t *clients, rmw_events_t *events, 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.
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)
Definition: types.h:262
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_take_serialized_message_with_info(const rmw_subscription_t *subscription, rmw_serialized_message_t *serialized_message, bool *taken, rmw_message_info_t *message_info, rmw_subscription_allocation_t *allocation)
Take a message without deserializing it and with its additional message information.
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...
Definition: types.h:140
rmw_ret_t rmw_take(const rmw_subscription_t *subscription, void *ros_message, bool *taken, rmw_subscription_allocation_t *allocation)
Take an incoming message from a subscription.
rmw_ret_t rmw_node_assert_liveliness(const rmw_node_t *node)
Manually assert that this node is alive (for RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE) ...
Definition: types.h:83
rmw_ret_t rmw_destroy_publisher(rmw_node_t *node, rmw_publisher_t *publisher)
Definition: types.h:163
rmw_ret_t rmw_destroy_node(rmw_node_t *node)
Finalize a given node handle, reclaim the resources, and deallocate the node handle.
Definition: types.h:176
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:188
Array of guard condition handles.
Definition: types.h:155
rmw_ret_t rmw_init_publisher_allocation(const rosidl_message_type_support_t *type_support, const rosidl_message_bounds_t *message_bounds, rmw_publisher_allocation_t *allocation)
Initialize a publisher allocation to be used with later publications.
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_send_request(const rmw_client_t *client, const void *ros_request, int64_t *sequence_id)
Array of client handles.
Definition: types.h:132
rmw_ret_t rmw_get_serialized_message_size(const rosidl_message_type_support_t *type_support, const rosidl_message_bounds_t *message_bounds, size_t *size)
Compute the size of a serialized message.
rmw_ret_t rmw_init_subscription_allocation(const rosidl_message_type_support_t *type_support, const rosidl_message_bounds_t *message_bounds, rmw_subscription_allocation_t *allocation)
Initialize a subscription allocation to be used with later takes.
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_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)
rmw_wait_set_t * rmw_create_wait_set(rmw_context_t *context, size_t max_conditions)
Create a wait set to store conditions that the middleware will block on.
ROS MiddleWare quality of service profile.
Definition: types.h:231
Definition: types.h:39