Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 171

Two Topics with Same Callback

$
0
0
Hi everyone, I am subscribing to two different topics (each with different md5sums) using a single callback. I am using the `message_filters` class to achieve this. In my broadcaster, I am publishing a `point cloud` and an opencv `image`. I want to subscribe in a separate code. My callback signature looks like so: void callback(const sensor_msgs::ImageConstPtr& ensensoImage, const sensor_msgs::PointCloud2ConstPtr& ensensoCloud) { cv::Mat ir; PointCloudT cloud; getImage(ensensoImage, ir); getCloud(ensensoCloud, cloud); ROS_INFO_STREAM("cloud: " << cloud); std::lock_guard lock(mutex); this->ir = ir; this->cloud = cloud; updateImage = true; updateCloud = true; } When I run my code, however, I get an `std::terminate` as follows: ``` user@user:~/catkin_ws$ rosrun ensenso ensenso_viewer terminate called after throwing an instance of 'ros::ConflictingSubscriptionException' what(): Tried to subscribe to a topic with the same name but different md5sum as a topic that was already subscribed [sensor_msgs/PointCloud2/1158d486dd51d683ce2f1be655c3c181 vs. sensor_msgs/Image/060021388200f6f0f447d0fcd9c64743] Aborted (core dumped) ``` Is it not possible to have a callback with different classes of a namespace or am I missing something? For reference, the whole code is [here](https://github.com/lakehanne/ensenso/blob/devel/src/ensenso_viewer.cxx). I would appreciate any help. Thanks!

Viewing all articles
Browse latest Browse all 171

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>