rosbridge_library.util.ros module
- rosbridge_library.util.ros.is_topic_published(node: Node, topic_name: str) bool
Check if a node has at least one publisher on the given topic.
Reads
node.publishers(the local entity list) rather than the rmw graph cache. The local list is populated synchronously insidecreate_publisherand cleared insidedestroy_publisher, so the result is deterministic with respect to the calling thread — no DDS-discovery round-trip is involved.
- rosbridge_library.util.ros.is_topic_subscribed(node: Node, topic_name: str) bool
Check if a node has at least one subscription on the given topic.
Reads
node.subscriptions(the local entity list) rather than the rmw graph cache; seeis_topic_publishedfor why this matters.
- rosbridge_library.util.ros.wait_for_executor_idle(executor: Executor, timeout: float = 5.0) None
Block until all tasks already queued on
executorhave been processed.Used by tests that schedule work on the executor and then need to assert on the post-condition from a different thread. Submits a no-op task and waits for it to run: tasks are FIFO on
SingleThreadedExecutor, so when the no-op completes every task enqueued before it has also completed.Raises
TimeoutErrorif the executor does not drain withintimeoutseconds, which usually means it is not being spun.