Skip to content

Commit fe25178

Browse files
committed
Merge branch 'PR/add-headerless-option-to-synchronize-republish' into koki_s/add-xz-option-to-download-data
2 parents fbfa42c + 80597ec commit fe25178

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

doc/jsk_topic_tools/scripts/synchronize_republish.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Parameters
3535

3636
If ``true``, approximate synchronization is used for synchoronizing assigned topics.
3737

38+
* ``~allow_headerless`` (Bool, Default: ``false``)
39+
40+
If ``true``, ``allow_headerless`` option of approximate synchronization is enabled.
41+
3842
* ``~queue_size`` (Integer, Default: ``100``)
3943

4044
Queue length for subscribing topics.

jsk_topic_tools/scripts/synchronize_republish.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,21 @@
99
def callback(*msgs):
1010
stamp = None
1111
for msg, pub in zip(msgs, pubs):
12-
if stamp is None:
13-
stamp = msg.header.stamp
14-
else:
15-
msg.header.stamp = stamp
12+
try:
13+
if stamp is None:
14+
stamp = msg.header.stamp
15+
else:
16+
msg.header.stamp = stamp
17+
except AttributeError:
18+
pass
1619
pub.publish(msg)
1720

1821

1922
if __name__ == '__main__':
2023
rospy.init_node('synchrnoze_republish')
2124
topics = rospy.get_param('~topics')
2225
use_async = rospy.get_param('~approximate_sync', False)
26+
allow_headerless = rospy.get_param('~allow_headerless', False)
2327
queue_size = rospy.get_param('~queue_size', 100)
2428
slop = rospy.get_param('~slop', 0.1)
2529
pubs = []
@@ -34,7 +38,7 @@ def callback(*msgs):
3438
subs.append(sub)
3539
if use_async:
3640
sync = message_filters.ApproximateTimeSynchronizer(
37-
subs, queue_size=queue_size, slop=slop)
41+
subs, queue_size=queue_size, slop=slop, allow_headerless=allow_headerless)
3842
else:
3943
sync = message_filters.TimeSynchronizer(subs, queue_size=queue_size)
4044
sync.registerCallback(callback)

0 commit comments

Comments
 (0)