subscribe to 4 different topics with 2 asus xtions callback error
Hello everyone,
I have 2 asus xtions and want to subscribe to both of the depth and rgb topics. But the callback of all 4 topics in my program never gets called. The problem only occurs when I subscribe to 4 different topics. Subscribing let's say twice the same depth topic works fine. I checked the topics in rviz and they are all correct. This is the code where I register the callback
message_filters::Subscriber<sensor_msgs::Image> depthSub1(nh, "/camera1/depth/image", 1);
message_filters::Subscriber<sensor_msgs::Image> colorSub1(nh, "/camera1/rgb/image_color", 1);
message_filters::Subscriber<sensor_msgs::Image> depthSub2(nh, "/camera2/depth/image", 1);
message_filters::Subscriber<sensor_msgs::Image> colorSub2(nh, "/camera2/rgb/image_color", 1);
message_filters::Synchronizer<SyncPolicy> sync(SyncPolicy(10), depthSub1, colorSub1,depthSub2, colorSub2);
sync.registerCallback(boost::bind(&PointCloudCalibration::callbackCombi, this, _1, _2, _3, _4));
SyncPolicy is defined as:
typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::Image, sensor_msgs::Image,sensor_msgs::Image, sensor_msgs::Image > SyncPolicy;
When I change depthSub2 "/camera2/depth/image" to "/camera1/depth/image" it works. It appears to me like if it would not be possible to subscribe to 4 different topics.
How can I fix that and what might be the reason?
Thanks in advance!