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

Subscribe to two different type-not synchronized topics

asked 2015-10-24 09:44:22 -0600

erivera1802 gravatar image

updated 2015-10-24 10:17:18 -0600

Hi there, I want to check two topics at the same time, but as the title says, they are different type and arent synchronized, so I think I cant use the message filter example in the ROS Wiki. Here is the relevant part of the code, where I subscribe only to the camera topic:

Inside the main:

image_transport::ImageTransport it(nh);
image_transport::Subscriber sub = it.subscribe("/ardrone/image_raw", 1, imageCallback);

Callback:

void imageCallback(const sensor_msgs::ImageConstPtr& msg)
{

I want to subscribe to /ardrone/image_raw and /ardrone/navdata topics. Image raw is type image transport and navdata is a custom type. Also, an acceptable option would be that the callback only response to the Navdata topic, but inside i could read the actual image in the image_raw topic, cause the navdata topic is faster as the camera topic

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-10-26 02:36:26 -0600

Wolf gravatar image

Have a look at message filters. It's probably what you need:

http://wiki.ros.org/message_filters Example: http://wiki.ros.org/message_filters#E...

Particular the ApproximateTime Policy may be of interest: http://wiki.ros.org/message_filters#A...

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-10-24 09:44:22 -0600

Seen: 205 times

Last updated: Oct 26 '15