ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

TimeSynchronizer (boost invalid initialization of reference)

asked 2013-04-29 00:28:13 -0600

Waterplant gravatar image

updated 2013-04-29 00:29:07 -0600

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> > >’
edit retag flag offensive close merge delete

Comments

1.Did you add the required header files ? 2.Did you add boost libraries and linked them in the CMakeLists.txt?

sai gravatar image sai  ( 2013-11-09 17:34:38 -0600 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2013-11-25 21:28:03 -0600

timster gravatar image

updated 2013-11-25 21:28:33 -0600

Could it be that you are simply missing a const before ImageConstPtr& left in the arguments of your callback?

Best

Tim

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-04-29 00:28:13 -0600

Seen: 1,326 times

Last updated: Nov 25 '13