Function rcl_wait_for_subscribers

Function Documentation

rcl_ret_t rcl_wait_for_subscribers(const rcl_node_t *node, rcl_allocator_t *allocator, const char *topic_name, const size_t count, rcutils_duration_value_t timeout, bool *success)

Wait for there to be a specified number of subscribers on a given topic.

Attribute

Adherence

Allocates Memory

Yes

Thread-Safe

No

Uses Atomics

No

Lock-Free

Maybe [1]

[1] implementation may need to protect the data structure with a lock

Parameters:
  • node[in] the handle to the node being used to query the ROS graph

  • allocator[in] to allocate space for the rcl_wait_set_t used to wait for graph events

  • topic_name[in] the name of the topic in question

  • count[in] number of subscribers to wait for

  • timeout[in] maximum duration to wait for subscribers

  • success[out] true if the number of subscribers is equal to or greater than count, or false if a timeout occurred waiting for subscribers.

Returns:

RCL_RET_OK if there was no errors, or

Returns:

RCL_RET_NODE_INVALID if the node is invalid, or

Returns:

RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or

Returns:

RCL_RET_TIMEOUT if a timeout occurs before the number of subscribers is detected, or

Returns:

RCL_RET_ERROR if an unspecified error occurred.