roslibjs/roslibpy synchronize topics

asked 2019-08-20 08:40:30 -0500

Hendrik Wiese gravatar image

updated 2019-08-20 09:32:23 -0500

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

edit retag flag offensive close merge delete

Comments

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

gvdhoorn gravatar image gvdhoorn  ( 2019-08-20 09:21:56 -0500 )edit

Of course! Done

Hendrik Wiese gravatar image Hendrik Wiese  ( 2019-08-20 09:32:43 -0500 )edit

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.

gvdhoorn gravatar image gvdhoorn  ( 2019-08-20 13:29:30 -0500 )edit

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.

Hendrik Wiese gravatar image Hendrik Wiese  ( 2019-09-03 08:01:13 -0500 )edit
1

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.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-03 08:04:06 -0500 )edit
1

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

Hendrik Wiese gravatar image Hendrik Wiese  ( 2019-09-03 12:38:19 -0500 )edit