message_filters code explained
Hi,
I am using this code in my node but I would like to understand it more (line by line): [of course I read : http://wiki.ros.org/message_filters ]
message_filters::Subscriber<sensor_msgs::Image> raw_image_subscriber(nh_, image_topic, queue_size_);
message_filters::Subscriber<sensor_msgs::CameraInfo> camera_info_subscriber(nh_, camera_info_topic, queue_size_);
message_filters::TimeSynchronizer<sensor_msgs::Image, sensor_msgs::CameraInfo> image_info_sync(raw_image_subscriber, camera_info_subscriber, queue_size_);
image_info_sync.registerCallback(boost::bind(&Node::frameCallback,this, _1, _2));
As far as I understood:
message_filters::Subscriber<sensor_msgs::Image> raw_image_subscriber(nh_, image_topic, queue_size_);
Creates an object of type message_filters::Subscriber<sensor_msgs::Image>
which is connected to the image_topic specified somewhere else in my code.
message_filters::Subscriber<sensor_msgs::CameraInfo> camera_info_subscriber(nh_, camera_info_topic, queue_size_);
Creates an object of type message_filters::Subscriber<sensor_msgs::CameraInfo>
which is connected to the canera_info_topic specified somewhere else in my code.
message_filters::TimeSynchronizer<sensor_msgs::Image, sensor_msgs::CameraInfo> image_info_sync(raw_image_subscriber, camera_info_subscriber, queue_size_);
Creates an object of type message_filters::TymeSynchronizer<sensor_msgs::Image, sensor_msgs::CameraInfo>
which is connected to the 2 subscribers created before.
If I understood it correctly it synchronizes incoming channels by the timestamps contained in their headers, and outputs them in the form of a single callback that takes the same number of channels.
Is it all correct?
image_info_sync.registerCallback(boost::bind(&Node::frameCallback,this, _1, _2));
This is the most difficult expression for me to understand. Why do I need the boost::bind
function? And how this function works?
Thanks in advance