Function rcl_wait_for_publishers
Defined in File graph.h
Function Documentation
-
rcl_ret_t rcl_wait_for_publishers(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 publishers on a given topic.
The
node
parameter must point to a valid node. The nodes graph guard condition is used by this function, and therefore the caller should take care not to use the guard condition concurrently in any other wait sets.The
allocator
parameter must point to a valid allocator.The
topic_name
parameter must not beNULL
, and must not be an empty string. It should also follow the topic name rules.This function blocks and will return when the number of publishers for
topic_name
is greater than or equal to thecount
parameter, or the specifiedtimeout
is reached.The
timeout
parameter is in nanoseconds. The timeout is based on system time elapsed. A negative value disables the timeout (i.e. this function blocks until the number of publishers is greater than or equals tocount
).The
success
parameter must point to a valid bool. Thesuccess
parameter is the output for this function and will be set.Attribute
Adherence
Allocates Memory
Yes
Thread-Safe
No
Uses Atomics
No
Lock-Free
Maybe [1]
- 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 publishers to wait for
timeout – [in] maximum duration to wait for publishers
success – [out]
true
if the number of publishers is equal to or greater than count, orfalse
if a timeout occurred waiting for publishers.
- 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 publishers is detected, or
- Returns:
RCL_RET_ERROR if an unspecified error occurred.