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

ImportError package.msg

asked 2014-10-17 09:30:16 -0500

laurent2101 gravatar image

updated 2014-10-17 12:22:42 -0500

Hi I have created a package(pwm), that contains a custom message(signal.msg). It seem to be compiled correctly. Because I can

ubuntu@arm:~/test/sandbox/pwm$ rosmsg show signal
uint8 freq
uint8 duty

ubuntu@arm:~/test/sandbox/pwm/msg$ ls

When i run a script which use the message i got an error.

ubuntu@arm:~$ rosrun pwm scripts/
Traceback (most recent call last):
  File "/home/ubuntu/test/sandbox/pwm/scripts/", line 4, in <module>
    from pwm.msg import signal
ImportError: No module named pwm.msg

Could you help me please ?

Here are some additional informations


ubuntu@arm:~/test/sandbox/pwm$ cat CMakeLists.txt 
cmake_minimum_required(VERSION 2.4.6)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)


#set the default path for built executables to the "bin" directory
#set the default path for built libraries to the "lib" directory

#uncomment if you have defined messages
#uncomment if you have defined services

#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})


ubuntu@arm:~/test/sandbox/pwm/msg$ export | grep ROS
    declare -x ROS_DISTRO="indigo" 
    declare -x ROS_ETC_DIR="/opt/ros/indigo/etc/ros"
    declare -x ROS_MASTER_URI="http://localhost:11311" 
    declare -x ROS_PACKAGE_PATH="/home/ubuntu/test/sandbox:/opt/ros/indigo/share:/opt/ros/indigo/stacks" 
    declare -x ROS_ROOT="/opt/ros/indigo/share/ros"
    declare -x ROS_WORKSPACE="/home/ubuntu/test"


ubuntu@arm:~/test/sandbox/pwm/msg$ echo $PYTHONPATH 


ubuntu@arm:~/test/sandbox/pwm$ rosmake 
[ rosmake ] rosmake starting...                                                 
[ rosmake ] No package specified.  Building ['pwm']                             
[ rosmake ] Packages requested are: ['pwm']                                     
[ rosmake ] Logging to directory /home/ubuntu/.ros/rosmake/rosmake_output-20141015-233222
[ rosmake ] Expanded args ['pwm'] to:
[rosmake-0] Starting >>> catkin [ make ]                                        
[rosmake-0] Finished <<< catkin ROS_NOBUILD in package catkin
 No Makefile in package catkin
[rosmake-0] Starting >>> genmsg [ make ]                                        
[rosmake-0] Finished <<< genmsg ROS_NOBUILD in package genmsg
 No Makefile in package genmsg
[rosmake-0] Starting >>> genlisp [ make ]                                       
[rosmake-0] Finished <<< genlisp ROS_NOBUILD in package genlisp
 No Makefile in package genlisp
[rosmake-0] Starting >>> genpy [ make ]                                         
[rosmake-0] Finished <<< genpy ROS_NOBUILD in package genpy
 No Makefile in package genpy
[rosmake-0] Starting >>> gencpp [ make ]                                        
[rosmake-0] Finished <<< gencpp ROS_NOBUILD in package gencppive 4/25 Complete ]
 No Makefile in package gencpp
[rosmake-0] Starting >>> message_generation [ make ]                            
[rosmake-0] Finished <<< message_generation ROS_NOBUILD in package message_generation
 No Makefile in package message_generation
[rosmake-0] Starting >>> cpp_common [ make ]                                    
[rosmake-0] Finished <<< cpp_common ROS_NOBUILD in package cpp_common
 No Makefile in package cpp_common
[rosmake-0] Starting >>> rostime [ make ]                                       
[rosmake-0] Finished <<< rostime ROS_NOBUILD in package rostime
 No Makefile in package rostime
[rosmake-0] Starting >>> roscpp_traits [ make ]                                 
[rosmake-0] Finished <<< roscpp_traits ROS_NOBUILD in package ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-10-17 12:44:55 -0500

updated 2014-10-17 12:45:39 -0500

It seems you are using the old rosbuild build system. Is that on purpose? If you are indeed running rosbuild on purpose, does your script properly "load the manifest" for your pwm package? See this question.

edit flag offensive delete link more


Yes, I used the old build system because the tutorials said it was simpler. After loading the manifest, the script worked perfectly. Thank you very much for your help.

laurent2101 gravatar image laurent2101  ( 2014-10-17 13:24:17 -0500 )edit

I'm unsure which tutorial you are referring to, but if you are developing new code, and you are on any version newer than Fuerte, you should definitely be using Catkin. It is a bit more complicated, but it is the current standard. No sense in learning a deprecated tool.

jarvisschultz gravatar image jarvisschultz  ( 2014-10-17 14:22:33 -0500 )edit

Question Tools


Asked: 2014-10-17 09:30:16 -0500

Seen: 623 times

Last updated: Oct 17 '14