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

ROS Beginner Tutorials: Writing a Simple Service and Client (python) - need some help

asked 2013-06-11 07:29:01 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi guys,

I'm following the ROS Tutorials and currently doing the item Examining the Simple Service and Client using the Python language ((<link>http:// www.ros.org/wiki/ROS/Tutorials/ExaminingServiceClient</link>)).

However when I try to run the client using the python command, I get this error:

viki@ROS:~/catkin_ws$ rosrun beginner_tutorials add_two_ints_server.py
Traceback (most recent call last):
  File "/home/viki/catkin_ws/src/beginner_tutorials/scripts/add_two_ints_server.py", line 3, in <module>
    from beginner_tutorials.srv import *
ImportError: No module named beginner_tutorials.srv

I just can't figure it out what's happening. I'm almost sure I've done all the steps in the previous tutorial ( link text ), 'cause everything seemed to work just as hoped:

viki@ROS:~/catkin_ws$ cd ~/catkin_ws
viki@ROS:~/catkin_ws$ catkin_make
Base path: /home/viki/catkin_ws
Source space: /home/viki/catkin_ws/src
Build space: /home/viki/catkin_ws/build
Devel space: /home/viki/catkin_ws/devel
Install space: /home/viki/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/viki/catkin_ws/build"
####
####
#### Running command: "make -j1" in "/home/viki/catkin_ws/build"
####
viki@ROS:~/catkin_ws$

Can anybody help me? Thanks in advance,

Batta

edit retag flag offensive close merge delete

Comments

Yes, the program built as hoped...

Batta gravatar image Batta  ( 2013-06-13 03:43:25 -0500 )edit
1

I see nothing indicating that beginner_tutorials was built. Is it in your workspace?

joq gravatar image joq  ( 2013-06-13 03:44:50 -0500 )edit

3 Answers

Sort by » oldest newest most voted
0

answered 2014-03-25 10:28:32 -0500

Warrior gravatar image

The problem was stemming from misspelling in the package name. It's now resolved.

edit flag offensive delete link more

Comments

What was the misspelling? I have seen this mentioned in another question about the same problem so perhaps the misspelling stems from the code give in the tutorial.

gracecopplestone gravatar image gracecopplestone  ( 2016-02-19 22:22:50 -0500 )edit
0

answered 2014-02-08 17:11:34 -0500

I'm not sure if in tutorials is missed the 'source' command. Try to source the setup.bash file in devel folder in your workspace:

source $YOUR_WORKSPACE/devel/setup.bash
edit flag offensive delete link more

Comments

I already did that, doesn't work though ... Someone help please ... I need to get ROS to work :(

Warrior gravatar image Warrior  ( 2014-02-09 05:06:53 -0500 )edit

Create another question for your own problem and include the output of `export | grep ROS´ and your CMakeLists.txt file

gustavo.velascoh gravatar image gustavo.velascoh  ( 2014-02-09 05:30:23 -0500 )edit
-1

answered 2014-02-08 12:55:46 -0500

Warrior gravatar image

updated 2014-02-09 05:05:22 -0500

Hi everyone. I have the same issue. I am using the Hydro distribution and I have followed the steps 1 to 16 for the beginner tutorials. Now, when I execute the command line rosrun beginner_tutorials add_two_ints_server.py I get the following error messages:

Traceback (most recent call last):
File "/home/$MY_NAME/catkin_ws/src/beginner_tutorial/scripts/add_two_ints_server.py", line 3, in <module>
from beginner_tutorials.srv import *
ImportError: No module named beginner_tutorials.srv

Also, when I execute the command line rosrun beginner_tutorials add_two_ints_client.py I get the following error messages:

Traceback (most recent call last):
  File "/home/$MY_NAME/catkin_ws/src/beginner_tutorial/scripts/add_two_ints_client.py", line 2, in <module>
    import roslib; roslib.load_manifest('beginner_tutorials')
  File "/opt/ros/hydro/lib/python2.7/dist-packages/roslib/launcher.py", line 62, in load_manifest
    sys.path = _generate_python_path(package_name, _rospack) + sys.path
  File "/opt/ros/hydro/lib/python2.7/dist-packages/roslib/launcher.py", line 93, in _generate_python_path
    m = rospack.get_manifest(pkg)
  File "/usr/lib/pymodules/python2.7/rospkg/rospack.py", line 159, in get_manifest
    return self._load_manifest(name)
  File "/usr/lib/pymodules/python2.7/rospkg/rospack.py", line 198, in _load_manifest
    retval = self._manifests[name] = parse_manifest_file(self.get_path(name), self._manifest_name)
  File "/usr/lib/pymodules/python2.7/rospkg/rospack.py", line 190, in get_path
    raise ResourceNotFound(name, ros_paths=self._ros_paths)
rospkg.common.ResourceNotFound: beginner_tutorials
ROS path [0]=/opt/ros/hydro/share/ros
ROS path [1]=/home/$MY_NAME/catkin_ws/src
ROS path [2]=/opt/ros/hydro/share
ROS path [3]=/opt/ros/hydro/stacks

Could you please help me with this?

Thank you

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-06-11 07:29:01 -0500

Seen: 1,855 times

Last updated: Feb 09 '14