compiling error for messge_filter
I'm using Ubuntu 16.04 with ROS kinect . Trying to write a message_filter to synchronize depth and color image from Kinect2.
but a alway have three errors while compiling,says like
error:ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function.
error: ‘void (spaceteam_ros_tool::Perception::*)(boost::shared_ptr > >&, boost::shared_ptr > >&)’ is not a class, struct, or union type typedef typename F::result_type type;
I think it has something to do with bind and callbackfuntion but don't have a clue about how to solve it.
Thank you for your help in Advance!
I defined a Class in this file
#pragma once
#include <dynamic_reconfigure/server.h>
#include <ros/forwards.h>
#include "spaceteam_ros_tool/PerceptionInterface.h"
#include <sensor_msgs/Image.h>
namespace spaceteam_ros_tool {
class Perception {
using Interface = PerceptionInterface;
using ReconfigureConfig = PerceptionConfig;
using ReconfigureServer = dynamic_reconfigure::Server<ReconfigureConfig>;
using Ima = sensor_msgs::Image;
public:
Perception(ros::NodeHandle, ros::NodeHandle);
private:
void callbackSubscriber(Ima::ConstPtr& Imagedepth, Ima::ConstPtr& Imagecolor);
void reconfigureRequest(const ReconfigureConfig&, uint32_t);
Interface interface_;
ReconfigureServer reconfigureServer_;
};
}
hier are the functions above
namespace spaceteam_ros_tool {
Perception::Perception(ros::NodeHandle nhPublic, ros::NodeHandle nhPrivate)
: interface_{nhPrivate}, reconfigureServer_{nhPrivate} {
interface_.fromParamServer();
reconfigureServer_.setCallback(boost::bind(&Perception::reconfigureRequest, this, _1, _2));
typedef message_filters::sync_policies::ApproximateTime<Ima, Ima> MySyncPolicy;
message_filters::Synchronizer<MySyncPolicy> sync(MySyncPolicy(10),*interface_.Kinect_depth_sub, *interface_.Kinect_color_sub);
sync.registerCallback(boost::bind(&callbackSubscriber, _1, _2));
rosinterface_handler::showNodeInfo();
}
void Perception::callbackSubscriber(Ima::ConstPtr& Imagedepth,Ima::ConstPtr& Imagecolor) { //
// processing
interface_.Kinect_depth_pub.publish(Imagedepth);
}
void Perception::reconfigureRequest(const ReconfigureConfig& config, uint32_t level) {
interface_.fromConfig(config);
}
} // namespace spaceteam_ros_tool
and i have the errors as following:
spaceteam_ros_tool:make /home/kal4-2/catkin_ws/logs/spaceteam_ros_tool/build.make.079.log
/home/kal4-2/catkin_ws/src/spaceteam_ros_tool/src/perception/perception.cpp: In constructor ‘spaceteam_ros_tool::Perception::Perception(ros::NodeHandle, ros::NodeHandle)’:
/home/kal4-2/catkin_ws/src/spaceteam_ros_tool/src/perception/perception.cpp:41:40: **error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&spaceteam_ros_tool::Perception::callbackSubscriber’ [-fpermissive]
sync.registerCallback(boost::bind(&callbackSubscriber, _1, _2));**
^
In file included from /usr/include/boost/bind.hpp:22:0,
from /opt/ros/kinetic/include/ros/publisher.h:35,
from /opt/ros/kinetic/include/ros/node_handle.h:32,
from /opt/ros/kinetic/include/dynamic_reconfigure/server.h:50,
from /home/kal4-2/catkin_ws/src/spaceteam_ros_tool/src/perception/perception.hpp:3,
from /home/kal4-2/catkin_ws/src/spaceteam_ros_tool/src/perception/perception.cpp:1:
/usr/include/boost/bind/bind.hpp: In instantiation of ‘struct boost::_bi::result_traits<boost::_bi::unspecified, void (spaceteam_ros_tool::Perception::*)(boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&, boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&)>’:
/usr/include/boost/bind/bind.hpp:883:48: required from ‘class boost::_bi::bind_t<boost::_bi::unspecified, void (spaceteam_ros_tool::Perception::*)(boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&, boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&), boost::_bi::list2<boost::arg<1>, boost::arg<2> > >’
/home/kal4-2/catkin_ws/src/spaceteam_ros_tool/src/perception/perception.cpp:41:66: required from here
/usr/include/boost/bind/bind.hpp:69:37: **error: ‘void ...