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

Revision history [back]

click to hide/show revision 1
initial version

I did not add below lines in package.xml

<build_depend>std_msgs</build_depend>
<build_depend>message_generation</build_depend>
<run_depend>std_msgs</run_depend>

and then it is able to generate service header according to the service files defined in srv folder.

In my node.hpp file I defined

private:
...
ros::ServiceClient serviceClient; //Client node to call service
my_node::Color serviceSetColor; //Service set color

And in node.cpp file

init(...){
...
serviceClient = n.serviceClient<r1mini_gui_teleop::color>("/set_led_color");
}
some function(...) ...
serviceClient.call(serviceSetColor);

Solved my problem.

I did not add below lines in package.xml

<build_depend>std_msgs</build_depend>
<build_depend>message_generation</build_depend>
<run_depend>std_msgs</run_depend>

and then it is able to generate service header according to the service files defined in srv folder.

In my node.hpp file I defined

private:
...
ros::ServiceClient serviceClient; //Client node to call service
my_node::Color serviceSetColor; //Service set color

And in node.cpp file

init(...){
...
serviceClient = n.serviceClient<r1mini_gui_teleop::color>("/set_led_color");
}
some function(...) ...
serviceClient.call(serviceSetColor);

Solved my problem.

I did not add below lines in package.xml

<build_depend>std_msgs</build_depend>
<build_depend>message_generation</build_depend>
<run_depend>std_msgs</run_depend>

and then it is able to generate service header according to the service files defined in srv folder.

In my node.hpp file I definedadded

#include "r1mini_gui_teleop/Color.h"
...
private:
...
ros::ServiceClient serviceClient; //Client node to call service
my_node::Color serviceSetColor; //Service set color

And in node.cpp file

init(...){
...
serviceClient = n.serviceClient<r1mini_gui_teleop::color>("/set_led_color");
}
some function(...) ...
serviceClient.call(serviceSetColor);

Solved my problem.