Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

regarding your reference question, it doesn't matter with boost bind if you replace or add parameters. It's just a matter of using the placeholders _1, _2, ... provided by boost for forwarding the original arguments or by providing your own ones.

Here you can find another answer in which two extra parameters are added (next to _1): LINK.

Regarding the difference between subscribeCamera and subscribe: both functions provide an overload that excepts the a boost::function type callback, therefore you can apply boost::bind to both of them.

Refer to the Code Doc for the overloaded methods:

subscribeCamera (const std::string &base_topic, uint32_t queue_size, const CameraSubscriber::Callback &callback, const ros::VoidPtr &tracked_object=ros::VoidPtr(), const TransportHints &transport_hints=TransportHints())

subscribe (const std::string &base_topic, uint32_t queue_size, const boost::function< void(const sensor_msgs::ImageConstPtr &)> &callback, const ros::VoidPtr &tracked_object=ros::VoidPtr(), const TransportHints &transport_hints=TransportHints())

Here the argument type CameraSubscriber::Callback is a typedef for a boost::function object accepting both default parameters. Pass your functor created with boost::bind here.