Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Do Not Merge] spot development branch #1710

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/jsk_topic_tools/scripts/synchronize_republish.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ Parameters

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

* ``~allow_headerless`` (Bool, Default: ``false``)

If ``true``, ``allow_headerless`` option of approximate synchronization is enabled.

* ``~queue_size`` (Integer, Default: ``100``)

Queue length for subscribing topics.
Expand Down
2 changes: 2 additions & 0 deletions jsk_data/src/jsk_data/download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def extract_file(path, to_directory='.', chmod=True):
opener, mode, getnames = zipfile.ZipFile, 'r', lambda f: f.namelist()
elif path.endswith('.tar.gz') or path.endswith('.tgz'):
opener, mode, getnames = tarfile.open, 'r:gz', lambda f: f.getnames()
elif path.endswith('.tar.xz'):
opener, mode, getnames = tarfile.open, 'r:xz', lambda f: f.getnames()
elif path.endswith('.tar.bz2') or path.endswith('.tbz'):
opener, mode, getnames = tarfile.open, 'r:bz2', lambda f: f.getnames()
else:
Expand Down
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
Loading