TimeSynchronizer (boost invalid initialization of reference)
I have again a problem building the boost TimeSynchronizer Callback. I hope you can help me :)
void callback (const ImageConstPtr& right, ImageConstPtr& left) {
}
int main(int argc, char** argv) {
ros::init(argc, argv, "stereo_vision");
ros::NodeHandle nh;
message_filters::Subscriber<Image> right_image(nh, "/stereo_camera/right/image_rect", 1);
message_filters::Subscriber<Image> left_image(nh, "/stereo_camera/left/image_rect", 1);
TimeSynchronizer<Image, Image> sync(right_image, left_image, 10);
sync.registerCallback(boost::bind(&callback, _1, _2));
ros::spin ();
return 0;
}
The error msg:
error: invalid initialization of reference of type ‘boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&’ from expression of type ‘const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >’
1.Did you add the required header files ? 2.Did you add boost libraries and linked them in the CMakeLists.txt?