no matching function for call to ‘ros::NodeHandle::advertiseService(const char [12], bool (Eddie::*)(), Eddie* const)’
Hi I am getting the following error:
**error: no matching function for call to ‘ros::NodeHandle::advertiseService(const char [12], bool (Eddie::*)(), Eddie* const)’**
Below is the code:
**This is my eddie.cpp class:**
include eddie.h
Eddie::Eddie(){
/ get_version_srv is a ros::ServiceServer declared in my .h file
// node_ is a ros::NodeHandle declared in my .h file
get_version_srv = node_.advertiseService("get_version", &Eddie::get_board_version, this);
node_handle_.param<std::string>("serial_port", port, port);
}
Eddie::~Eddie()
}
bool Eddie::get_board_version(parallax_eddie_robot::get_version::Request &req, parallax_eddie_robot::get_version::Response &res)
/DO STUFF
eturn true;
//MAIN FUNCTION
int main(int argc, char** argv)
OS_INFO("Initializing the robot's control board");
os::init(argc, argv, "parallax_board");
ddie eddie;
os::Rate loop_rate(10);
eturn 0;
*Here is my eddie.h file:**
fndef _EDDIE_H
define _EDDIE_H
include ros/ros.h
include fcntl.h
include termios.h
include semaphore.h
include string
include sstream
include map
class Eddie {
public:
Eddie();
virtual ~Eddie();
private:
sem_t mutex;
struct termios tio;
int tty_fd;
ros::NodeHandle node_handle_;
ros::ServiceServer get_version_srv_;
bool get_board_version(parallax_eddie_robot::get_version::Request &req, parallax_eddie_robot::get_version::Response &res);
};
endif
*With the new changes described in the post below I get the following errors**
**Also modified above code (from original post) to reflect the new changes I have made**
/home/opslab/fuerte_workspace/sandbox/parallax_eddie_robot/include/eddie.h:36:26: error: ‘parallax_eddie_robot’ has not been declared
/home/opslab/fuerte_workspace/sandbox/parallax_eddie_robot/include/eddie.h:36:69: error: expected ‘,’ or ‘...’ before ‘&’ token
/home/opslab/fuerte_workspace/sandbox/parallax_eddie_robot/src/eddie.cpp:7:98: error: no matching function for call to ‘ros::NodeHandle::advertiseService(const char [12], bool (Eddie::*)(int), Eddie* const)’
/home/opslab/fuerte_workspace/sandbox/parallax_eddie_robot/src/eddie.cpp:7:98: note: candidates are:
/opt/ros/fuerte/include/ros/node_handle.h:821:17: note: template<class T, class MReq, class MRes> ros::ServiceServer ros::NodeHandle::advertiseService(const string&, bool (T::*)(MReq&, MRes&), T*)
/opt/ros/fuerte/include/ros/node_handle.h:859:17: note: template<class T, class MReq, class MRes> ros::ServiceServer ros::NodeHandle::advertiseService(const string&, bool (T::*)(ros::ServiceEvent<MReq, MRes>&), T*)
/opt/ros/fuerte/include/ros/node_handle.h:898:17: note: template<class T, class MReq, class MRes> ros::ServiceServer ros::NodeHandle::advertiseService(const string&, bool (T::*)(MReq&, MRes&), const boost::shared_ptr<X>&)
/opt/ros/fuerte/include/ros/node_handle.h:938:17: note: template<class T, class MReq, class MRes> ros::ServiceServer ros::NodeHandle::advertiseService(const string&, bool (T::*)(ros::ServiceEvent<MReq, MRes>&), const boost::shared_ptr<X>&)
/opt/ros/fuerte/include/ros/node_handle.h:975:17: note: template<class MReq, class MRes> ros::ServiceServer ros::NodeHandle::advertiseService(const string&, bool (*)(MReq&, MRes&))
/opt/ros/fuerte/include/ros/node_handle.h:1011:17: note: template<class MReq, class MRes> ros::ServiceServer ros::NodeHandle::advertiseService(const string&, bool (*)(ros::ServiceEvent<MReq, MRes>&))
/opt/ros/fuerte/include/ros/node_handle.h:1045:17: note: template<class MReq, class MRes> ros::ServiceServer ros::NodeHandle::advertiseService(const string&, const boost::function<bool(MReq&, MRes&)>&, const VoidConstPtr&)
/opt/ros/fuerte/include/ros/node_handle.h:1083:17: note: template<class S> ros::ServiceServer ros::NodeHandle::advertiseService(const string&, const boost::function<bool(S&)>&, const ...
I made the necessary changes and made my get_board_version function take in the necessary parameters so the function signature looks like the following: bool get_board_version(parallax_eddie_robot::get_version::Request &req, parallax_eddie_robot::get_version::Response &res);
However, I still get the same error along with new errors: I will put the list of errors above by editing the original post.
Thanks petermilani. However, I am still getting the "‘parallax_eddie_robot’ has not been declared" error. As well as "error: ‘bool Eddie::get_board_version’ is not a static member of ‘class Eddie'". Also an error saying that my parameters for the get_version_function 'was not declared in this scope'