robofit / but_velodyne

ROS packages for Velodyne 3D LIDARs provided by Robo@FIT group.
GNU Lesser General Public License v3.0
142 stars 98 forks source link

The Callback function is not working. #26

Closed aihanb closed 4 years ago

aihanb commented 5 years ago

Hi,

I meet a problem about message_filters, would you like give me some suggestion? I use approximate time synchronizer with two topics (Camera and LiDAR), all nodes are compiled without any error or warning, but the callback function is not called. At the same time, it seems that the two topics are being published at the correct rate. (camera average rate: 20, LiDAR average rate: 10)
I attach the code below for help.
Thx in advance.

void Callback(const sensor_msgs::ImageConstPtr& img, const sensor_msgs::PointCloud2ConstPtr& pc2)
{
    ROS_INFO("Reached Callback");
}
int main(int argc, char** argv)
{
    ros::init(argc, argv, "camera_laser_calib");
    ros::NodeHandle nh;
    message_filters::Subscriber<PointCloud2> laser40(nh, "/pandar_points", 1);
    message_filters::Subscriber<Image> img(nh, "/camera/image_color", 1);

    typedef sync_policies::ApproximateTime<Image,PointCloud2> MySyncPolicy;
    Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), img, laser40);
    sync.registerCallback(boost::bind(&Callback, _1, _2));

    ros::spin();

    return 0;
}
janu0510 commented 3 years ago

Hi @aihanb . I know this has been closed, but I would like to know if you found a solution to this issue. I am running as given in the code, with correct topics being subscribed. However, my callback function doesn't seem to be called. I dont know what I'm missing. Would really appreciate the help. Thanks in advance!