roslibjs/roslibpy synchronize topics
Hi everyone,
is there a (simple/royal road) way to synchronize topics with rosbridge_suite
/roslibjs
/roslibpy
?
ROS supports synchronization of messages with a Header
based on their stamp
. There are multiple classes for that purpose such as message_filters/TimeSynchronizer
that accepts two topics and invokes callbacks with messages with equal (or similar, depending on the chosen synchronizer) timestamps.
I'd like to know if there's something similar in rosbridge_suite
/roslibjs
/roslibpy
?
Cheers
It might be beneficial if you could clarify what you mean by "synchronize topics"?
Of course! Done
I'm not aware of any direct support, but
message_filters
is a relatively small amount of Python (source) with relatively limited use ofrospy
.You may be able to just take it and replace
rospy
entities with their equivalents fromroslibpy
.I've come up with a very basic ApproximateTimeSynchronizer for just two topics for roslibpy. I save the previous messages of the topics and compare the respective other message's timestamp to the newly arrived message. If the delta is small enough I'll invoke a callback with them both. Very basic but does its job for me.
It would be nice if you could either post the result here as an answer or link to a repository that contains it.
Edit: or perhaps contribute it to
roslibpy
itself.Sure will. Just gimme some time to clean up the code.