ROS常见问题1——找不到包
1 问题
每次打开终端会提示找不到相关包或者相关文件。比如在查看自己在catkin工作区间下创建的消息时提示找不到文件:
输入:
$ rosmsg show beginner_tutorials/Num
输出:
Unable to load msg [beginner_tutorials/Num]: Cannot locate message [Num]: unknown package [beginner_tutorials] on search path [{'rosconsole': ['/opt/ros/indigo/share/rosconsole/msg'], 'catkin': ['/opt/ros/indigo/share/catkin/msg'], 'angles': ['/opt/ros/indigo/share/angles/msg'], 'image_view': ['/opt/ros/indigo/share/image_view/msg'].....................
2 解决
一种方法是在新打开终端使用catkin_ws工作区间里的工程前,都先输入以下代码注册:
source ~/catkin_ws/devel/setup.bash
另一种方法只需输入一次,永久有效:
rhl@rhl-Lenovo-G480:~$ echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
rhl@rhl-Lenovo-G480:~$ source ~/.bashrc
这是永久注册的方法,每次打开新的终端时不用重复注册。