## page was renamed from Helper functions Collecting useful helper functions here until they can find a proper home {{{#!python def is_publishing(node_name, topic_name): topics_published = [info(s).name for s in info(nodes[node_name]).subs] # <-- this one was a bit tricky to work out return True in [s.find(topic_name) >= 0 for s in topics_published] }}} ''credit: Patrick Bouffard'' {{{#!python def wait_for_topic(node_name, topic_name, sleep_time=0.5): loginfo("Waiting for topic %s from node %s" % (topic_name, node_name)) while not is_publishing(node_name, topic_name): sleep(sleep_time) loginfo("Topic found!") }}} ''credit: Patrick Bouffard'' == To be implemented == {{{#!python wait_for(lambda x: x.fieldname > 42, '/some/topic') do_cool_stuff() }}}