ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Two Subscriptions synchronization

asked 2014-07-22 06:01:42 -0500

ROSkinect gravatar image

updated 2014-07-22 06:08:13 -0500

I'm subscribing to two cameras (as stereo system) with different FPS using one node.

How can I make sure that after few minutes, I'm taking the same images of the world with the two cameras like there is no delay with the two taken images ?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
2

answered 2014-07-22 06:22:43 -0500

sai gravatar image

You can use the ExactTime and ApproximateTime Synchronization methods in ROS. http://wiki.ros.org/message_filters/A...

http://wiki.ros.org/message_filters

In the answer at the link below, there is a sample code that subscribes to two point clouds and uses ApproximateTime policy for synchronization.

http://answers.ros.org/question/18628...

edit flag offensive delete link more

Comments

This answer was also pretty helpful for me: http://answers.ros.org/question/60903/timesynchronizer-callback-problem/. Shows code showing how to synchronize pretty well.

jc2016 gravatar image jc2016  ( 2014-07-22 09:54:00 -0500 )edit
1

answered 2014-07-22 06:51:46 -0500

demmeln gravatar image

Others have already correctly pointed out the message filters, which can help. They operate on the message time stamp of the image messages, which is set by the ROS camera driver. It is important to make sure the two machines that where the cameras are connected are time-synchronized (which is the case if it is the same machine).

Depending on your need, e.g. if you merely want to display the images and make sure that you show recent images, you can also simply set the size of the message queues for your subscriber to 1. This makes sure that whenever you process an incoming message, it is the most recent one received on that topic (i.e. you don't build a backlog of unprocessed images in the message queue).

If you want to do some stereo computation with both images, in particular since you note that the cameras publish at different rates, I assume that the images taken will never have matching timestamps. As mentioned above, the message fileters can help to find good image pairs regardsless, but depending on your exact application and e.g. speed of motion this might not be enough. In that case you will need to change your camera setup to ensure proper synchronization of the shutters.

edit flag offensive delete link more
1

answered 2014-07-22 06:25:11 -0500

McMurdo gravatar image

See 4. Time Synchronizer in this page:

http://wiki.ros.org/message_filters

Also refer to :

http://answers.ros.org/question/9705/...

This above question also has some sample code.

and

http://wiki.ros.org/image_transport

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-07-22 06:01:42 -0500

Seen: 2,178 times

Last updated: Jul 22 '14