hello All,
I’m facing a serious problem related to topic subscribing in ROS.
I want to subscribe two topics simultaneously using ApproximateTime Policy or ExactTime Policy.
My implementtation is as given below.
ros::init(argc, argv, “vision_node”);
ros::NodeHandle nh;
message_filters::Subscriber<Image> RGB_sub(nh, "/camera/rgb/image_color", 1);
message_filters::Subscriber<sensor_msgs::PointCloud2> PointCloud_sub(nh, "/camera/depth/points", 1);
typedef sync_policies::ApproximateTime<Image, sensor_msgs::PointCloud2> MySyncPolicy;
// ApproximateTime takes a queue size as its constructor argument, hence MySyncPolicy(10)
Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), RGB_sub, PointCloud_sub);
sync.registerCallback(boost::bind(&callback, _1, _2));
and the callback is like this…
void callback(const ImageConstPtr& image_rgb, const sensor_msgs::PointCloud2::ConstPtr& pCloud)
{
cout<<“Hello”<<endl;
}
But this is not working.
what can be done to solve this problem? I’m using ROS Kinectic and Astra Pro.
Thanks,
Prasanna