Skip to content

Commit

Permalink
[jsk_topic_tools] add allow_headerless option to synchronize_republish
Browse files Browse the repository at this point in the history
  • Loading branch information
sktometometo committed Nov 29, 2023
1 parent 78faabe commit 864c4aa
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions jsk_topic_tools/scripts/synchronize_republish.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,21 @@
def callback(*msgs):
stamp = None
for msg, pub in zip(msgs, pubs):
if stamp is None:
stamp = msg.header.stamp
else:
msg.header.stamp = stamp
try:
if stamp is None:
stamp = msg.header.stamp
else:
msg.header.stamp = stamp
except AttributeError:
pass
pub.publish(msg)


if __name__ == '__main__':
rospy.init_node('synchrnoze_republish')
topics = rospy.get_param('~topics')
use_async = rospy.get_param('~approximate_sync', False)
allow_headerless = rospy.get_param('~allow_headerless', False)
queue_size = rospy.get_param('~queue_size', 100)
slop = rospy.get_param('~slop', 0.1)
pubs = []
Expand All @@ -34,7 +38,7 @@ def callback(*msgs):
subs.append(sub)
if use_async:
sync = message_filters.ApproximateTimeSynchronizer(
subs, queue_size=queue_size, slop=slop)
subs, queue_size=queue_size, slop=slop, allow_headerless=allow_headerless)
else:
sync = message_filters.TimeSynchronizer(subs, queue_size=queue_size)
sync.registerCallback(callback)
Expand Down

0 comments on commit 864c4aa

Please sign in to comment.