Skip to content

Commit fb6d0b5

Browse files
authored
WaitForTopics: wait for publisher-subscriber connection to be established (#474)
Signed-off-by: Giorgio Pintaudi <[email protected]> Signed-off-by: Giorgio Pintaudi <[email protected]>
1 parent 747b603 commit fb6d0b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

launch_testing_ros/launch_testing_ros/wait_for_topics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def method_3():
6363
topic_list = [('topic_1', String), ('topic_2', String)]
6464
wait_for_topics = WaitForTopics(topic_list, timeout=5.0, trigger=trigger_function)
6565
# The trigger function will be called inside the wait() method after the
66-
# subscribers are created and before the publishers are connected.
66+
# subscribers are created and the publishers are connected.
6767
assert wait_for_topics.wait("Hello World!")
6868
print('Given topics are receiving messages !')
6969
wait_for_topics.shutdown()
@@ -108,9 +108,9 @@ def _prepare_ros_node(self):
108108

109109
def wait(self, *args, **kwargs):
110110
self.__ros_node.start_subscribers(self.topic_tuples)
111+
self.__ros_node.any_publisher_connected.wait(self.timeout)
111112
if self.trigger:
112113
self.trigger(self.__ros_node, *args, **kwargs)
113-
self.__ros_node.any_publisher_connected.wait(self.timeout)
114114
return self.__ros_node.msg_event_object.wait(self.timeout)
115115

116116
def shutdown(self):

0 commit comments

Comments
 (0)