ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

kbedolla's profile - activity

2022-07-19 07:24:21 -0500 received badge  Nice Question (source)
2018-09-17 15:41:11 -0500 received badge  Student (source)
2013-02-27 11:18:50 -0500 received badge  Famous Question (source)
2013-02-15 05:17:15 -0500 received badge  Famous Question (source)
2013-01-29 00:16:44 -0500 received badge  Notable Question (source)
2012-12-08 06:31:12 -0500 received badge  Popular Question (source)
2012-11-24 17:53:18 -0500 received badge  Scholar (source)
2012-11-24 17:53:06 -0500 commented answer Cannot ouput string service via ROS_INFO

Thank you!

2012-11-24 16:45:01 -0500 asked a question Cannot ouput string service via ROS_INFO

I have a service of type string, my server simply responds with a string. I am trying to implement my client to simply call the service and ROS_INFO out the response. However, when I try to compile I get an error on the line where I am doing the ROS_INFO output. The error is:

error: cannot pass objects of non-trivially-copyable type ‘struct std::basic_string<char>’ through ‘...’

Here is my code:

parallax_eddie_robot::get_version srv;

if(get_version_client_.call(srv))

{

ROS_INFO("%s",srv.response.version);

}

I don't know why it thinks my service is returning a struct because my service file (myservice.srv) is only for a string. It looks like this:


string version

2012-11-24 13:46:14 -0500 received badge  Teacher (source)
2012-11-24 13:46:14 -0500 received badge  Self-Learner (source)
2012-11-24 10:44:45 -0500 received badge  Supporter (source)
2012-11-24 10:44:23 -0500 answered a question no matching function for call to ‘ros::NodeHandle::advertiseService(const char [12], bool (Eddie::*)(), Eddie* const)’

Fixed it! Long story short, I forgot to include the header for my service in my header file. Thanks for everyone's answers!

2012-11-24 10:43:14 -0500 received badge  Notable Question (source)
2012-11-22 12:24:46 -0500 commented question no matching function for call to ‘ros::NodeHandle::advertiseService(const char [12], bool (Eddie::*)(), Eddie* const)’

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'

2012-11-22 11:03:50 -0500 received badge  Popular Question (source)
2012-11-21 13:25:47 -0500 received badge  Editor (source)
2012-11-21 13:16:51 -0500 commented question no matching function for call to ‘ros::NodeHandle::advertiseService(const char [12], bool (Eddie::*)(), Eddie* const)’

However, I still get the same error along with new errors: I will put the list of errors above by editing the original post.

2012-11-21 13:12:44 -0500 commented question no matching function for call to ‘ros::NodeHandle::advertiseService(const char [12], bool (Eddie::*)(), Eddie* 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);

2012-11-21 11:53:08 -0500 asked a question 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 ...
(more)