rmw  beta1
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 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 
58 #ifndef RMW__RMW_H_
59 #define RMW__RMW_H_
60 
61 #if __cplusplus
62 extern "C"
63 {
64 #endif
65 
66 #include <stdbool.h>
67 #include <stddef.h>
68 #include <stdint.h>
69 
70 #include "rosidl_generator_c/message_type_support_struct.h"
71 #include "rosidl_generator_c/service_type_support.h"
72 
73 #include "rmw/macros.h"
74 #include "rmw/qos_profiles.h"
75 #include "rmw/types.h"
76 #include "rmw/visibility_control.h"
77 
80 const char *
82 
86 rmw_init(void);
87 
90 rmw_node_t *
91 rmw_create_node(const char * name, size_t domain_id);
92 
97 
99 
128 const rmw_guard_condition_t *
130 
135  const rmw_node_t * node,
136  const rosidl_message_type_support_t * type_support,
137  const char * topic_name,
138  const rmw_qos_profile_t * qos_policies);
139 
142 rmw_ret_t
144 
147 rmw_ret_t
148 rmw_publish(const rmw_publisher_t * publisher, const void * ros_message);
149 
154  const rmw_node_t * node,
155  const rosidl_message_type_support_t * type_support,
156  const char * topic_name,
157  const rmw_qos_profile_t * qos_policies,
158  bool ignore_local_publications);
159 
162 rmw_ret_t
164 
167 rmw_ret_t
168 rmw_take(const rmw_subscription_t * subscription, void * ros_message, bool * taken);
169 
172 rmw_ret_t
174  const rmw_subscription_t * subscription,
175  void * ros_message,
176  bool * taken,
177  rmw_message_info_t * message_info);
178 
181 rmw_client_t *
183  const rmw_node_t * node,
184  const rosidl_service_type_support_t * type_support,
185  const char * service_name,
186  const rmw_qos_profile_t * qos_policies);
187 
190 rmw_ret_t
191 rmw_destroy_client(rmw_node_t * node, rmw_client_t * client);
192 
195 rmw_ret_t
197  const rmw_client_t * client,
198  const void * ros_request,
199  int64_t * sequence_id);
200 
203 rmw_ret_t
205  const rmw_client_t * client,
206  rmw_request_id_t * request_header,
207  void * ros_response,
208  bool * taken);
209 
214  const rmw_node_t * node,
215  const rosidl_service_type_support_t * type_support,
216  const char * service_name,
217  const rmw_qos_profile_t * qos_policies);
218 
221 rmw_ret_t
222 rmw_destroy_service(rmw_node_t * node, rmw_service_t * service);
223 
226 rmw_ret_t
228  const rmw_service_t * service,
229  rmw_request_id_t * request_header,
230  void * ros_request,
231  bool * taken);
232 
235 rmw_ret_t
237  const rmw_service_t * service,
238  rmw_request_id_t * request_header,
239  void * ros_response);
240 
245 
248 rmw_ret_t
250 
253 rmw_ret_t
254 rmw_trigger_guard_condition(const rmw_guard_condition_t * guard_condition);
255 
257 
269 rmw_create_waitset(size_t max_conditions);
270 
273 rmw_ret_t
275 
277 
312 rmw_ret_t
313 rmw_wait(
314  rmw_subscriptions_t * subscriptions,
315  rmw_guard_conditions_t * guard_conditions,
316  rmw_services_t * services,
317  rmw_clients_t * clients,
318  rmw_waitset_t * waitset,
319  const rmw_time_t * wait_timeout);
320 
323 rmw_ret_t
325  const rmw_node_t * node,
326  rmw_topic_names_and_types_t * topic_names_and_types);
327 
330 rmw_ret_t
332  rmw_topic_names_and_types_t * topic_names_and_types);
333 
336 rmw_ret_t
338  const rmw_node_t * node,
339  const char * topic_name,
340  size_t * count);
341 
344 rmw_ret_t
346  const rmw_node_t * node,
347  const char * topic_name,
348  size_t * count);
349 
352 rmw_ret_t
353 rmw_get_gid_for_publisher(const rmw_publisher_t * publisher, rmw_gid_t * gid);
354 
357 rmw_ret_t
358 rmw_compare_gids_equal(const rmw_gid_t * gid1, const rmw_gid_t * gid2, bool * result);
359 
361 
389 rmw_ret_t
391  const rmw_node_t * node,
392  const rmw_client_t * client,
393  bool * is_available);
394 
395 #if __cplusplus
396 }
397 #endif
398 
399 #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_waitset_t * rmw_create_waitset(size_t max_conditions)
Create a waitset to store conditions that the middleware will block on.
rmw_guard_condition_t * rmw_create_guard_condition(void)
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:201
Array of service handles.
Definition: types.h:102
Array of subsciber handles.
Definition: types.h:87
#define RMW_WARN_UNUSED
Definition: macros.h:28
Definition: types.h:147
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_get_topic_names_and_types(const rmw_node_t *node, rmw_topic_names_and_types_t *topic_names_and_types)
rmw_ret_t rmw_destroy_subscription(rmw_node_t *node, rmw_subscription_t *subscription)
Definition: types.h:188
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_wait(rmw_subscriptions_t *subscriptions, rmw_guard_conditions_t *guard_conditions, rmw_services_t *services, rmw_clients_t *clients, rmw_waitset_t *waitset, const rmw_time_t *wait_timeout)
Waits on sets of different waitable entities and returns when one is ready.
int rmw_ret_t
Definition: types.h:29
rmw_ret_t rmw_destroy_client(rmw_node_t *node, rmw_client_t *client)
Definition: types.h:53
Definition: types.h:140
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:67
rmw_ret_t rmw_destroy_waitset(rmw_waitset_t *waitset)
rmw_ret_t rmw_count_publishers(const rmw_node_t *node, const char *topic_name, size_t *count)
rmw_ret_t rmw_destroy_service(rmw_node_t *node, rmw_service_t *service)
Definition: types.h:195
rmw_ret_t rmw_take_response(const rmw_client_t *client, rmw_request_id_t *request_header, void *ros_response, bool *taken)
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)
rmw_ret_t rmw_destroy_publisher(rmw_node_t *node, rmw_publisher_t *publisher)
rmw_ret_t rmw_destroy_node(rmw_node_t *node)
rmw_node_t * rmw_create_node(const char *name, size_t domain_id)
rmw_ret_t rmw_publish(const rmw_publisher_t *publisher, const void *ros_message)
Definition: types.h:153
rmw_ret_t rmw_init(void)
Definition: types.h:74
Definition: types.h:60
Array of guard condition handles.
Definition: types.h:132
Definition: types.h:46
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:117
rmw_ret_t rmw_destroy_topic_names_and_types(rmw_topic_names_and_types_t *topic_names_and_types)
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)
Definition: types.h:180
Definition: types.h:38