ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
In my case: I am using python. I face same error. I was following this tutorial link text
The problem was ROS command "catkin_make install" (the last step of generating message) was not creating the code required to be generated for custom messages, for python, cpp and lisp, which basically helps python to understand the import statement. this generated code gets generated in :
~/catkin_ws/devel/lib/python2.7/dist-packages/package-name/msg (in case of python)
The solution : The problem was, In the tutorial I followed link text
find the lines :
catkin_package( ...
CATKIN_DEPENDS message_runtime ...
...)
I uncommented this lines. I dont know why this step shows that it is uncommented. I commented it and run the last step
catkin_make install
which made the required code in --
~/catkin_ws/devel/lib/python2.7/dist-packages/package-name/msg
check if it works: open terminal (ctrl+alt+T) you should already be running
roscore
in another terminal already move to your workspace by -
cd ~/workspace-name
source it-
source devel/setup.bash
type
python
and hit enter (to open python interpreter)
now enter command -
from package-name.msg import custom_msg
eg:
from std_msgs.msg import String
if you dont see any error you are done.