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

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
[pwm/signal]:
uint8 freq
uint8 duty

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

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

ubuntu@arm:~$ rosrun pwm scripts/talker.py
Traceback (most recent call last):
  File "/home/ubuntu/test/sandbox/pwm/scripts/talker.py", 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

CMakeLists.txt

ubuntu@arm:~/test/sandbox/pwm$ cat CMakeLists.txt 
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# 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)

rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#uncomment if you have defined messages
rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()

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

export

ubuntu@arm:~/test/sandbox/pwm/msg$ export | grep ROS
    declare -x ROSLISP_PACKAGE_DIRECTORIES="" 
    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"

Pythonpath

ubuntu@arm:~/test/sandbox/pwm/msg$ echo $PYTHONPATH 
/opt/ros/indigo/lib/python2.7/dist-packages

rosmake

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:
['pwm']                                   
[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 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

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 talker.py script properly "load the manifest" for your pwm package? See this question.

edit flag offensive delete link more

Comments

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
1

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

Stats

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

Seen: 615 times

Last updated: Oct 17 '14