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

Unable to compile server node [closed]

asked 2017-11-07 10:35:57 -0500

inani47 gravatar image

updated 2017-11-07 13:22:51 -0500

jayess gravatar image

Hi: I am getting the following error:

error: no matching function for call to ‘ros::NodeHandle::advertiseService(const char [15], void (&)(beginner_tutorials::stringEditor::Request&, beginner_tutorials::stringEditor::Response&))’
   ros::ServiceServer service = n.advertiseService("editBaseString", editor);

This is my stringEditorServer.cpp file:

#include "ros/ros.h"
#include "beginner_tutorials/stringEditor.h"

 void editor(beginner_tutorials::stringEditor::Request  &req,
     beginner_tutorials::stringEditor::Response &res)
{
  res.output = "count to 100 ";
  ROS_INFO("sending back response");
}

int main(int argc, char **argv)
{
  ros::init(argc, argv, "stringEditorServer");
  ros::NodeHandle n;

  ros::ServiceServer service = n.advertiseService("editBaseString", editor);
  ros::spin();

  return 0;
}

This is my stringEditor.srv file:

string input
---
string output
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by NEngelhard
close date 2017-11-08 00:37:41.487549

1 Answer

Sort by » oldest newest most voted
1

answered 2017-11-07 11:12:14 -0500

NEngelhard gravatar image

Your callback has to return a bool.

edit flag offensive delete link more

Comments

Thank you good, Sir. You are a life saver.

inani47 gravatar image inani47  ( 2017-11-07 11:39:04 -0500 )edit
1

If that worked, please mark the question as answered (checkmark at this question)

NEngelhard gravatar image NEngelhard  ( 2017-11-07 12:06:30 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-11-07 10:32:22 -0500

Seen: 122 times

Last updated: Nov 07 '17