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

"error: ‘__s_getServerMD5Sum’ is not a member of" when adding a service to an existing class

asked 2017-11-03 16:36:46 -0500

3mul0r gravatar image

updated 2017-11-10 14:15:06 -0500

TL;DR

Trying to add two new services to a class definition but we are getting and error saying __s_getServerMD5Sum is not a member of each of them. Our new services are implemented exactly as all of the existing services.

Details

We are implementing a ur_modern_driver node from: github.com/ThomasTimm/ur_modern_driver

Our classes are being added to ur_ros_wrapper.cpp. With an unmodified installation of this node everything compiles and runs as expected. However, we need to add additional services to the RosWrapper class to provide control of the robots free drive mode.

The two new services are called enterFreeDriveMode and exitFreeDriveMode.

As far as we can tell we have implemented our new services correctly. In short our service implementation looks like this:

//create the service servers

ros::ServiceServer enterFreeDriveMode_srv_;
ros::ServiceServer exitFreeDriveMode_srv_;

//initialize the services

enterFreeDriveMode_srv_ = nh_.advertiseService("ur_driver/enterFreeDriveMode", &RosWrapper::enterFreeDriveMode, this);
exitFreeDriveMode_srv_ = nh_.advertiseService("ur_driver/exitFreeDriveMode", &RosWrapper::exitFreeDriveMode, this);

//service callback class methods

bool enterFreeDriveMode(ur_msgs::EnterFreeDriveModeRequest& req, ur_msgs::EnterFreeDriveModeResponse& resp) {
            robot_.enterFreeDriveMode(true);
            resp.success = true;
        return resp.success;
    }

bool exitFreeDriveMode(ur_msgs::ExitFreeDriveModeRequest& req, ur_msgs::ExitFreeDriveModeResponse& resp) {
            robot_.exitFreeDriveMode(true);
            resp.success = true;
        return resp.success;
    }

//EnterFreeDriveMode.srv and ExitFreeDriveMode.srv have the exact same definition

bool start
---
bool success

When we run catkin_make we get the following errors:

[ 88%] Building CXX object ur_modern_driver/CMakeFiles/ur_driver.dir/src/ur_ros_wrapper.cpp.o In file included from /opt/ros/kinetic/include/ros/service_client.h:33:0,
                 from /opt/ros/kinetic/include/ros/node_handle.h:35,
                 from /opt/ros/kinetic/include/ros/ros.h:45,
                 from /home/evilbot/catkin_ws/src/ur_modern_driver/include/ur_modern_driver/do_output.h:23,
                 from /home/evilbot/catkin_ws/src/ur_modern_driver/include/ur_modern_driver/ur_realtime_communication.h:23,
                 from /home/evilbot/catkin_ws/src/ur_modern_driver/include/ur_modern_driver/ur_driver.h:24,
                 from /home/evilbot/catkin_ws/src/ur_modern_driver/src/ur_ros_wrapper.cpp:19: /opt/ros/kinetic/include/ros/service_traits.h: In instantiation of ‘static const char* ros::service_traits::MD5Sum<M>::value() [with M = ur_msgs::enterFreeDriveModeRequest_<std::allocator<void>>]’: >/opt/ros/kinetic/include/ros/service_traits.h:79:102: required from ‘const char* ros::service_traits::md5sum() [with M
= ur_msgs::enterFreeDriveModeRequest_<std::allocator<void>>]’ >/opt/ros/kinetic/include/ros/advertise_service_options.h:60:25: required from ‘void ros::AdvertiseServiceOptions::init(const string&, const boost::function<bool(MReq&, MRes&)>&) [with MReq = ur_msgs::enterFreeDriveModeRequest_<std::allocator<void>>; MRes = >ur_msgs::enterFreeDriveModeResponse_<std::allocator<void> >; std::__cxx11::string = >std::__cxx11::basic_string<char>]’ /opt/ros/kinetic/include/ros/node_handle.h:881:5: required from ‘ros::ServiceServer ros::NodeHandle::advertiseService(const string&, bool (T::*)(MReq&, MRes&), T*) [with T = RosWrapper; MReq = ur_msgs::enterFreeDriveModeRequest_<std::allocator<void>>; MRes = > > >ur_msgs::enterFreeDriveModeResponse_<std::allocator<void>>; std::__cxx11::string = >std::__cxx11::basic_string<char>]’ /home/evilbot/catkin_ws/src/ur_modern_driver/src/ur_ros_wrapper.cpp:232:43:   required from here /opt/ros/kinetic/include/ros/service_traits.h:47:34: error: ‘__s_getServerMD5Sum’ is not a member of ‘ur_msgs::enterFreeDriveModeRequest_<std::allocator<void>>’
     return M::__s_getServerMD5Sum().c_str();
                                  ^ /opt/ros/kinetic/include/ros/service_traits.h: In instantiation of ‘static const char* ros::service_traits::MD5Sum<M>::value() [with M = ur_msgs::enterFreeDriveModeResponse_<std::allocator<void>>]’: >/opt/ros ...
(more)
edit retag flag offensive close merge delete

Comments

1

You've lef out the most important bit of info: the ur_msgs/EnterFreeDriveMode and ur_msgs/ExitFreeDriveMode service definitions. Those are not standard services, so you need to include those.

I'm guessing, but depending no your svc defs, it should be resp.success.data = true;.

gvdhoorn gravatar image gvdhoorn  ( 2017-11-04 05:45:24 -0500 )edit

Our new services are implemented exactly as all of the existing services.

Also: did you create new service defs?

gvdhoorn gravatar image gvdhoorn  ( 2017-11-04 05:45:49 -0500 )edit

FInally: please edit your original question and copy-paste the compiler error message again. Then please select it and press the Preformatted Text button (the one with 101010 on it). Don't use 'block comments' for code/error msgs/etc.

gvdhoorn gravatar image gvdhoorn  ( 2017-11-04 05:46:57 -0500 )edit

Updated. Sorry I should have got those the first time.
I also noted that these classes are being added to ur_ros_wrapper.cpp if you want to see the original on GH. All of the existing services use resp.success = true;. I'll give that a shot later today though. Thx!

3mul0r gravatar image 3mul0r  ( 2017-11-04 10:55:22 -0500 )edit
1

I also noted that these classes are being added to ur_ros_wrapper.cpp

not sure what this means.

To add a service server:

  1. write a new srv spec
  2. #include the header(s) in the file you're going to add the srv to
  3. add ros::ServiceServers
  4. add callbacks
gvdhoorn gravatar image gvdhoorn  ( 2017-11-04 14:54:38 -0500 )edit
1

Suggestion: if all you're doing is triggering something, I would not create custom services, but use std_srvs/Trigger.

gvdhoorn gravatar image gvdhoorn  ( 2017-11-04 14:55:42 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2017-11-20 21:55:28 -0500

3mul0r gravatar image

We experienced this error when adding our new services to an existing class that was fully functional. We also verified that we received the same error on a second system. We added our code to the second system from scratch to ensure we wouldn't copy over some unseen coding error. This issue continued to persist through many hours of debugging.

In the end we attempted to recreate this issue on a fresh install of Ubuntu and ros kinetic. Fortunately for us the fresh environment resolved the issue. Same code, fresh install, no issues. We have since done a fresh install on all our dev systems and are up and running with our additional services. Now that we have cleaned our dev systems this issue can no longer be recreated.

edit flag offensive delete link more

Comments

I'm happy that you got things to work for you, but this should not have been needed.

Did you at any point rm -rf your catkin_ws/devel and catkin_ws/build directories? There is some heavy caching / creation of references / symlinks there which could have interfered.

gvdhoorn gravatar image gvdhoorn  ( 2017-11-22 02:46:20 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-11-03 16:36:46 -0500

Seen: 1,871 times

Last updated: Nov 20 '17