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

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

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

RosFan19 gravatar image

Hi,

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
1

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

Wolf gravatar image

have a look at http://wiki.ros.org/message_filters

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

http://wiki.ros.org/message_filters#T...

edit flag offensive delete link more

Comments

This is exactly what I needed. Thanks!

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

Question Tools

1 follower

Stats

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

Seen: 149 times

Last updated: Apr 20 '15