Synchronization with 8 incoming channels, registerCallback boost::bind -> compilation error
Hi all,
UPDATE: I found a workaround which I posted at the end of this question
I try to use ApproximateTime Synchronization with 8 channels, but I get a compilation error. Strangely it works with 4.
Here's some of the code: (The error is at sync_->registerCallback(boost::bind(&S2::filter_image, this, _1, _2, _3, _4, _5, _6, _7, _8, "ok")); )
class S2 {
ros::NodeHandle nh_;
image_transport::ImageTransport image_transporter_;
boost::unordered_map<std::string, boost::shared_ptr<image_transport::SubscriberFilter> > response_; //images from C1
//Synchronizer
typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::Image, sensor_msgs::Image,
sensor_msgs::Image, sensor_msgs::Image,
sensor_msgs::Image, sensor_msgs::Image,
sensor_msgs::Image, sensor_msgs::Image> syncPolicy;
typedef message_filters::Synchronizer<syncPolicy> mySynchronizer;
boost::shared_ptr<mySynchronizer> sync_;
public:
S2(ros::NodeHandle nh): image_transporter_(nh) {
nh_ = nh;
read_parameters();
}
void read_parameters(){
//Subscribe to C1 images
sync_.reset( new mySynchronizer ( syncPolicy(10),
*C1_response_[subscribe_strings.at(0)].get(),
*C1_response_[subscribe_strings.at(1)].get(),
*C1_response_[subscribe_strings.at(2)].get(),
*C1_response_[subscribe_strings.at(3)].get(),
*C1_response_[subscribe_strings.at(4)].get(),
*C1_response_[subscribe_strings.at(5)].get(),
*C1_response_[subscribe_strings.at(6)].get(),
*C1_response_[subscribe_strings.at(7)].get()));
sync_->registerCallback(boost::bind(&S2::filter_image, this, _1, _2, _3, _4, _5, _6, _7, _8, "ok"));
}
void filter_image(const sensor_msgs::ImageConstPtr& original_image1, const sensor_msgs::ImageConstPtr& original_image2,
const sensor_msgs::ImageConstPtr& original_image3, const sensor_msgs::ImageConstPtr& original_image4,std::string name){
}
};
int main(int argc, char **argv){
ros::init(argc, argv, "S2_node");
ros::NodeHandle nh;
S2 s2(nh);
ros::spin();
return 0;
}
The error I get is:
S2_new_node.cpp: In member function ‘void S2::read_parameters()’:
S2_new_node.cpp:88:102: error: no matching function for call to ‘bind(void (S2::*)(const ImageConstPtr&, const ImageConstPtr&, const ImageConstPtr&, const ImageConstPtr&, std::string), S2* const, boost::arg<1>&, boost::arg<2>&, boost::arg<3>&, boost::arg<4>&, boost::arg<5>&, boost::arg<6>&, boost::arg<7>&, boost::arg<8>&, const char [3])’
/work/ros/hmax/src/S2_new_node.cpp:88:102: note: candidates are:
/usr/include/boost/bind/bind.hpp:1298:5: note: template<class R, class F> boost::_bi::bind_t<R, F, boost::_bi::list0> boost::bind(F)
/usr/include/boost/bind/bind.hpp:1306:5: note: template<class R, class F, class A1> boost::_bi::bind_t<R, F, typename boost::_bi::list_av_1<A1>::type> boost::bind(F, A1)
/usr/include/boost/bind/bind.hpp:1314:5: note: template<class R, class F, class A1, class A2> boost::_bi::bind_t<R, F, typename boost::_bi::list_av_2<A1, A2>::type> boost::bind(F, A1, A2)
/usr/include/boost/bind/bind.hpp:1322:5: note: template<class R, class F, class A1, class A2, class A3> boost::_bi::bind_t<R, F, typename boost::_bi::list_av_3<A1, A2, A3>::type> boost::bind(F, A1, A2, A3)
/usr/include/boost/bind/bind.hpp:1330:5: note: template<class R, class F, class A1, class A2, class A3, class A4> boost::_bi::bind_t<R, F, typename boost::_bi::list_av_4<A1, A2, A3, A4>::type> boost::bind(F, A1, A2, A3, A4)
/usr/include/boost/bind/bind.hpp:1338:5: note: template<class R, class F, class A1, class ...
Please provide the complete error message. You left out the interesting part. See the support page.
complete error message added :) I hope it helps.
It would be great if you could reformat it as code, not as citation. The line breaks make it hard to read.
Ups sorry, just changed it.
As I just added, might it be possible, that the problem is occurring due to boost 1.46 and not 1.48?