本博客运行环境为Ubuntu 18.04.
今天在ROS工作区下编译时遇到如下错误:
RLException: [racecar.launch] is neither a launch file in package [racecar_gazebo] nor is [racecar_gazebo] a launch file name
The traceback for the exception was written to the log file
报错才想起没有添加环境变量,一段时间没做相关应用都有点搞忘了hhh
解决方案
方案1
回去再次编译:
catkin_make
添加环境变量:
source ./devel/setup.bash
方案2
相比方案1,这个不需要每次编写都添加环境变量了。
打开这个文件:
sudo gedit ~/.bashrc
在该文件的最后添加如下代码
catkin_ws为我的ROS工作路径。
source ~/catkin_ws/devel/setup.bash
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/catkin_ws/
然后重启bashrc
source ~/.bashrc
查看ROS路径是否添加上
echo $ROS_PACKAGE_PATH
设置成功会显示你添加的路径。