Skip to content

Commit 5c789a7

Browse files
sean85914SEAN.LU
and
SEAN.LU
authored
wait_for_topic support topic remapping (#2159)
Co-authored-by: SEAN.LU <[email protected]>
1 parent b9bdd3f commit 5c789a7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clients/rospy/src/rospy/client.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -408,15 +408,16 @@ def wait_for_message(topic, topic_type, timeout=None):
408408
wfm = _WFM()
409409
s = None
410410
try:
411-
s = rospy.topics.Subscriber(topic, topic_type, wfm.cb)
411+
resolve_name = rospy.names.resolve_name(topic)
412+
s = rospy.topics.Subscriber(resolve_name, topic_type, wfm.cb)
412413
if timeout is not None:
413414
if isinstance(timeout, rospy.Duration):
414415
timeout = timeout.to_sec()
415416
timeout_t = time.time() + timeout
416417
while not rospy.core.is_shutdown() and wfm.msg is None:
417418
rospy.rostime.wallsleep(0.01)
418419
if time.time() >= timeout_t:
419-
raise rospy.exceptions.ROSException("timeout exceeded while waiting for message on topic %s"%topic)
420+
raise rospy.exceptions.ROSException("timeout exceeded while waiting for message on topic %s"%resolve_name)
420421

421422
else:
422423
while not rospy.core.is_shutdown() and wfm.msg is None:

0 commit comments

Comments
 (0)