C++; arguments of message_filter's register_callback

asked 2019-11-30 19:00:38 -0600

kane_choigo gravatar image

updated 2019-11-30 19:02:19 -0600

Hello.

I'm using Ubuntu 16.04 and ROS kinetic.

I've just got a little problem.

Because I'm not still familiar with c++ programming, I don't know the below codes exactly.

message_filters::Subscriber<Image> image_sub(nh, "image", 1);
message_filters::Subscriber<CameraInfo> info_sub(nh, "camera_info", 1);
TimeSynchronizer<Image, CameraInfo> sync(image_sub, info_sub, 10);

registerCallback(boost::bind(&callback, _1, _2, _3));   //  <------- this part!! ------>

What does each argumet_1, _2, _3 mean?

In python, I've ever used message_filter like following:

ts = message_filters.TimeSynchronizer([image_sub, info_sub], 10)
ts.registerCallback(callback)

and I guess maybe they both have the same meaning.

But I'm still not sure what the _1, _2, _3 means in registerCallback(boost::bind(&callback, _1, _2, _3));

PS. Maybe this belongs to C++ 's part simply, I think. But even so, would you please give me a piece of helpful advice?

Thanks in advance :)

edit retag flag offensive close merge delete

Comments

1

While this is really a C++ question (not a ROS one) as it is about boost::bind(..), which is a generic piece of functionality from Boost, not ROS, I believe #q250014 answers a similar question.

Could you check that question and see whether it clears things up for you?

gvdhoorn gravatar imagegvdhoorn ( 2019-12-01 06:19:08 -0600 )edit