Robotics StackExchange | Archived questions

PR2-joint angles tutorial no module named srv

Hello,

I was trying to do the PR2 tutorial - Getting the current joint angles with ROS Indigo in Ubuntu 14.04 but I'm stuck with a problem regarding the import of the service message. I keep getting the following error when trying to run the service node:

rosrun jointstateslistener jointstateslistener.py

Traceback (most recent call last):
File "../catkin_ws/src/joint_states_listener/src/joint_states_listener.py", line 8, in <module>
from joint_states_listener.srv import *
File "../catkin_ws/src/joint_states_listener/src/joint_states_listener.py", line 8, in <module>
from joint_states_listener.srv import *
ImportError: No module named srv

My package contains a .srv file called ReturnJointStates.srv as mentioned in the tutorial.

Whenever I run rossrv show jointstateslistener/ReturnJointStates I get the same information (and it appears when doing rossrv list as well):

string[] name
---
uint32[] found
float64[] position
float64[] velocity
float64[] effort

I can also find the file in ~/catkinws/devel/lib/python2.7/dist-packages/jointstates_listeners/srv.

On the other hand, when I do a rosrun on the test program, which also does an import on this srv file, it has no problem running.

Also, the begginer's tutorial regarding services works fine.

My $PYTHONPATH shows: ~/catkin_ws/devel/lib/python2.7/dist-packages:/opt/ros/indigo/lib/python2.7/dist-packages

My CMakeLists.txt is as follows:

cmake_minimum_required(VERSION 2.8.3)
project(joint_states_listener)

find_package(catkin REQUIRED COMPONENTS
  message_generation
  rospy
  sensor_msgs
  std_msgs
)

## Generate services in the 'srv' folder
add_service_files(
  FILES
  ReturnJointStates.srv
)

## Generate added messages and services with any dependencies listed here
generate_messages(
  DEPENDENCIES
  sensor_msgs
  std_msgs
)

catkin_package(
   CATKIN_DEPENDS rospy sensor_msgs std_msgs message_runtime
)

include_directories(
  ${catkin_INCLUDE_DIRS}
)

I'm not sure if it has anything to do with that (maybe there is something else causing an error and it's pointing to the wrong line?) or if there is something wrong with the code. I have no idea where to look at this point.

Any ideas or help would be really appreciated !

Asked by TDTron on 2016-02-26 19:28:44 UTC

Comments

Answers