Service with class method
I simply want to advertise a service from my main() using a class method as the callback.:
int main(int argc, char **argv){
ros::init(argc, argv, "conversion");//Init the ROS node
ros::NodeHandle nh;//Get the node handle
//My code (issue):
convert_pos2lin asd;//Create the object
ros::ServiceServer srv_ = nh.advertiseService("pos2lin", &convert_pos2lin::convert, &asd);
//The example code which works fine:
AddTwo a;
ros::ServiceServer ss = nh.advertiseService("add_two_ints", &AddTwo::add, &a);
ROS_INFO("Ready.");
ros::spin();
return 0;
Where the class method has the signature:
bool convert(scibot_control::srv_conversion::Request &req, scibot_control::srv_conversion::Response &res);
Despite reading the tutorials and such on this, i have been unable to do so. I am always met with the build error - no matching function for call to advertiseService...
Please upload the whole source file somewhere like pastebin.com and also add the error log. It is a bit difficult to tell what can be the problem from the snippets you gave.