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

Using two topic's information in a subscriber's callback

asked 2015-04-20 10:23:54 -0600

RosFan19 gravatar image


I have a design problem.

I have a topic with an image, that needs to be analyzed and I need to get a certain coordinate from it. I also have another topic with a certain coordinate.

I need to use both of those coordinates in a callback method. So let's say I have a subscriber's callback:

callback(imageInfo) {
    //I only get the imageinfo here

So I get the imageinfo there but I need to use the certain coordinate info also, to calculate a result. I could create a global variable for the certain coordinate and have a different subscriber with a callback setting its value and then use the global variable in the callback(imageinfo).

But is there a better way? It doesn't seem that good.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-04-20 11:28:23 -0600

Wolf gravatar image

have a look at

if your messages have Header fields with sync'ed time stamps you could use the TimeSynchronizer for instance:

edit flag offensive delete link more


This is exactly what I needed. Thanks!

RosFan19 gravatar image RosFan19  ( 2015-04-20 13:06:33 -0600 )edit

Question Tools

1 follower


Asked: 2015-04-20 10:23:54 -0600

Seen: 148 times

Last updated: Apr 20 '15