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

Tubbs's profile - activity

2013-01-13 13:45:23 -0500 received badge  Popular Question (source)
2013-01-13 13:45:23 -0500 received badge  Notable Question (source)
2013-01-13 13:45:23 -0500 received badge  Famous Question (source)
2011-08-02 11:26:20 -0500 marked best answer Simple Service and Client Tutorial Problem

At the top of the tutorial, in section 1.1, it says to make sure to build on two completed tutorials:

http://www.ros.org/wiki/ROS/Tutorials/CreatingPackage http://www.ros.org/wiki/ROS/Tutorials/CreatingMsgAndSrv#Creating_a_srv

I suspect that using those will resolve your issue.

2011-06-16 05:27:29 -0500 answered a question Simple Service and Client Tutorial Problem

Well, I have finally managed to get the example to build. To do so:

  1. copy the TwoInts.h file from roscpp_tutorials to the include folder of your tutorial project.
  2. rename the namespace for the TwoInts.h file to your project name and go through and change every recurrance. i.e. since my project was under beginner_tutorials, change every roscpp_tutorials::TwoInt to beginner_tutorials::TwoInt
  3. in your add_two_ints_server.cpp and add_two_ints_client.cpp files, make sure the include refers to where you put the TwoInts.h (also, make sure its not 'AddTwoInts.h' like the tutorial)
  4. When you go to use TwoInts in your client and server file, make sure it refers to your namespace (for me it was beginner_tutorials::TwoInt).
2011-06-15 06:50:06 -0500 received badge  Organizer (source)
2011-06-15 06:49:18 -0500 asked a question Simple Service and Client Tutorial Problem

I am going through the tutorial with ROS, and its been fairly smooth so far. However, I just got to the section on creating a simple service and client in c++, and regardless of what I do, I keep running into errors when making add_two_ints_client.cpp and add_two_ints_server.cpp. They both call on a header file called AddTwoInts.h, however the tutorial never went over what that was. To compensate for that, I went and grabbed the TwoInts.h header file from the roscpp_tutorials package. At first I put it under beginners_tutorials like the example suggested, but I received a message stating beginner_tutorials was not declared in this scope. I did, however, get the code to accept TwoInts.h by just throwing it in src with the rest of the code and just calling

#include "TwoInts.h"

With that out of the way, I now receive an additional error down the line when I go to use TwoInts. I go to call

ros::ServiceClient client = n.serviceClient<TwoInts>("add_two_ints");

but the compiler says it doesn't know what TwoInts is. I then tried beginner_tutorials::TwoInts, then TwoInts::TwoInts, and even roscpp::TwoInts, but each time, it could not make.

My code looks almost identical to the sample code (aside from it being in a different location). I keep going back to past tutorials hoping to find something that mentions TwoInts.h, but if its there, I can't find it.

Has anyone run into this? How am I supposed to solve this?