Tutorials/WritingServiceClient(python) - beginner_tutorials.srv
http://wiki.ros.org/ROS/Tutorials/Wri...
I am missing a step where beginner_tutorials.srv is created.
Somewhat expected, when running add_two_ints_server.py I get the error
ImportError: No module named beginner_tutorials.srv
Trying to use AddTwoInts.srv instead did not get me anywhere ..
Here is CmakeList.txt
project(beginner_tutorials)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
message_generation
)
add_message_files(
FILES
Num.msg
)
add_service_files(
FILES
AddTwoInts.srv
)
generate_messages(
DEPENDENCIES
std_msgs
)
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES beginner_tutorials
CATKIN_DEPENDS roscpp rospy std_msgs message_runtime
# DEPENDS system_lib
)
include_directories(
${catkin_INCLUDE_DIRS}
)
Here is package.xml
<?xml version="1.0"?>
<package>
<name>beginner_tutorials</name>
<version>0.0.0</version>
<description>The beginner_tutorials package</description>
<maintainer email="z@todo.todo">z</maintainer>
<license>TODO</license>
<build_depend>message_generation</build_depend>
<run_depend>message_runtime</run_depend>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<run_depend>roscpp</run_depend>
<run_depend>rospy</run_depend>
<run_depend>std_msgs</run_depend>
<export>
</export>
</package>
Here is the content of srv directory
z@z-P5Q-EM:~/catkin_ws/src/beginner_tutorials/srv$ ls
AddTwoInts.srv beginner_tutorials.srv
z@z-P5Q-EM:~/catkin_ws/src/beginner_tutorials/srv$ cat AddTwoInts.srv
int64 a
int64 b
---
int64 sum
z@z-P5Q-EM:~/catkin_ws/src/beginner_tutorials/srv$ cat beginner_tutorials.srv
int64 a
int64 b
---
int64 sum
rossrv output
z@z-P5Q-EM:~/catkin_ws/src/beginner_tutorials/srv$ rossrv show beginner_tutorials.srv
[beginner_tutorials/beginner_tutorials]:
int64 a
int64 b
---
int64 sum
z@z-P5Q-EM:~/catkin_ws/src/beginner_tutorials/srv$ rossrv show AddTwoInts
[beginner_tutorials/AddTwoInts]:
int64 a
int64 b
---
int64 sum
[rospy_tutorials/AddTwoInts]:
int64 a
int64 b
---
int64 sum
Have you successfully run
catkin_make
? That is what should actually convert the service definition into Python and C++ code that can be used in a node. Also, make sure that you have sourced yoursetup.bash
in the terminal you are running the server in.catkin_make runs fine, just like tutorials up to that point. in .bashrc I have
catkin_make output