ImportError: No module named xxxxx.msg/srv解决方法
问题描述
在学ROS的时候遇到了这样一个报错:
Traceback (most recent call last):
File "/home/def/catkin_ws/src/arbotix_ros/arbotix_python/bin/arbotix_driver", line 33, in <module>
from arbotix_msgs.msg import *
ImportError: No module named arbotix_msgs.msg
[arbotix-2] process has died [pid 21722, exit code 1, cmd /home/def/catkin_ws/src/arbotix_ros/arbotix_python/bin/arbotix_driver __name:=arbotix __log:=/home/def/.ros/log/f70e0f32-9fbe-11ea-b20e-54e1ad5912f7/arbotix-2.log].
log file: /home/def/.ros/log/f70e0f32-9fbe-11ea-b20e-54e1ad5912f7/arbotix-2*.log
主要问题就是No module named arbotix_msgs.msg
,查阅资料后发现是因为这个msg
是自己定义的msg
,即使在编译以后在rosmsg list
里面能够查到也不行。解决方法如下,很简单。
解决方法
- 正常在workspace里面
catkin_make
编译。 - 运行你的
roslaunch
之前需要先手动source
一下,比如source ~/catkin_ws/devel/setup.bash
.
参考
https://answers.ros.org/question/271620/importerror-no-module-named-xxxxmsg/