Robotics StackExchange | Archived questions

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

Asked by Hendrik Wiese on 2019-08-20 08:40:30 UTC

Comments

It might be beneficial if you could clarify what you mean by "synchronize topics"?

Asked by gvdhoorn on 2019-08-20 09:21:56 UTC

Of course! Done

Asked by Hendrik Wiese on 2019-08-20 09:32:43 UTC

I'm not aware of any direct support, but message_filters is a relatively small amount of Python (source) with relatively limited use of rospy.

You may be able to just take it and replace rospy entities with their equivalents from roslibpy.

Asked by gvdhoorn on 2019-08-20 13:29:30 UTC

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.

Asked by Hendrik Wiese on 2019-09-03 08:01:13 UTC

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.

Asked by gvdhoorn on 2019-09-03 08:04:06 UTC

Sure will. Just gimme some time to clean up the code.

Asked by Hendrik Wiese on 2019-09-03 12:38:19 UTC

Answers