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

rosserial - cannot import [custom messages] package

asked 2013-04-17 16:54:05 -0600

Ernest gravatar image

updated 2013-04-27 10:42:25 -0600


I am having trouble using a custom ROS message type on my Arduino. I believe I have the latest version of ros-fuerte-rosserial

I have written & compiled a custom package called arduino_msgs, which worked since rosmsg show finds it. I have ran rosrun rosserial_client to "bind" it to my arduino libraries, and I have received a good ouput.

My arduino node has two subscribers & one publisher. The publisher uses an arduino_msgs message type, and the subscribers are std_msgs. When I run rosrun rosserial_python /dev/ttyACM0, I get the following output (lunarex is the name of my computer..)

    lunarex@LunarEx:~/McGill_LunarEx_2013/Arduino$ rosrun rosserial_python /dev/ttyACM0[INFO] [WallTime: 1366251538.465538] ROS Serial Python Node
[INFO] [WallTime: 1366251538.474754] Connected on /dev/ttyACM0 at 57600 baud
[ERROR] [WallTime: 1366251540.605275] Cannot import package : arduino_msgs
[ERROR] [WallTime: 1366251540.607357] sys.path was ['/opt/ros/fuerte/stacks/rosserial/rosserial_msgs/src', '/opt/ros/fuerte/stacks/rosserial/rosserial_python/src', '/opt/ros/fuerte/stacks/rosserial/rosserial_python/nodes', '/opt/ros/fuerte/lib/python2.7/dist-packages', '/home/lunarex/McGill_LunarEx_2013/Arduino', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-installer', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
[ERROR] [WallTime: 1366251540.609387] Failed to parse publisher: 'NoneType' object has no attribute 'msg'
[INFO] [WallTime: 1366251540.619060] Setup Subscriber on ang_speed [std_msgs/Float32]
[INFO] [WallTime: 1366251540.630073] Setup Subscriber on lin_speed [std_msgs/Float32]
[ERROR] [WallTime: 1366251540.633170] Tried to publish before configured, topic id 125
[ERROR] [WallTime: 1366251540.640945] Tried to publish before configured, topic id 125
[ERROR] [WallTime: 1366251540.656522] Tried to publish before configured, topic id 125
[ERROR] [WallTime: 1366251540.674111] Tried to publish before configured, topic id 125
[ERROR] [WallTime: 1366251540.685796] Tried to publish before configured, topic id 125
[ERROR] [WallTime: 1366251540.702021] Tried to publish before configured, topic id 125 infinitum

so the bottom line is that my custom package (arduino_msgs) cannot be imported by rosserial, and therefore I cannot publish to a topic with that message type. Everything else works fine, so I can work around it using std_msgs, but if someone could point me to a solution that would be great.

Thanks! Ernest


I have acted upon fergs's three suggestions.

1) rosmake arduino_msgs produces this correct output

[ rosmake ] rosmake starting...                                                                                 
[ rosmake ] Packages requested are: ['arduino_msgs']                                                            
[ rosmake ] Logging to directory /home/lunarex/.ros/rosmake/rosmake_output20130427-200123                      
[ rosmake ] Expanded args ['arduino_msgs'] to:
[rosmake-0] Starting >>> std_msgs [ make ]                                                                      
[rosmake-0] Finished <<< std_msgs  No Makefile in package std_msgs                                              
[rosmake-0] Starting >>> arduino_msgs [ make ]                                                                  
[rosmake-0] Finished <<< arduino_msgs [PASS] [ 5.27 seconds ]                                                   
[ rosmake ] Results:                                                                                            
[ rosmake ] Built 2 packages with 0 ...
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-04-18 18:39:14 -0600

fergs gravatar image

updated 2013-04-22 20:52:23 -0600

rosmsg show uses the raw .msg file -- not the compiled python version of the message which rosserial is trying to load. Either arduino_msgs is not on your ROS package path, or you likely have not setup your CMakeLists.txt file to generate messages -- or you have not compiled your custom arduino_msgs package.

edit flag offensive delete link more



Thank you for your response (& for rosserial!). I have performed your three suggestions to no avail. I have included more information as an edit to my question.

Ernest gravatar image Ernest  ( 2013-04-27 09:59:46 -0600 )edit

answered 2016-04-17 06:50:30 -0600

Wolf gravatar image

Hi, i have had this error message recently.

The cause was that the message was not build inside my package. I forgot about the dependency on message_generation in the CMakeLists.txt and package.xml in the package that was building the message....

edit flag offensive delete link more

Question Tools



Asked: 2013-04-17 16:54:05 -0600

Seen: 2,328 times

Last updated: Apr 17 '16