ros回炉1-管理环境

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhangjiali12011/article/details/78822043

ros环境管理

在ros中,如果需要在某个空间下执行命令,就要source该空间的setup.bash文件,(source命令大致意思为使用定义当前工作空间执行命令)

如果在未source的空间执行命令,例如roslaunch某个文件,会有报错,类似

zjl@zjl-HP-ZBook-15u-G3:~ $ roslaunch my_moveit my_moveit.launch
[my_moveit.launch] is neither a launch file in package [my_moveit] nor is [my_moveit] a launch file name
The traceback for the exception was written to the log file

某些默认目录每次打开终端运行命令都需要输入

$ source /opt/ros/indigo/setup.bash

这时候可以使用以下命令将其写入.bashrc文件,每次打开终端都会默认执行该source命令

$echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
source ~/.bashrc

此外,如果多次写入source命令或有误,在打开终端时会有报错,类似

bash: /opt/ros/jade/setup.bash: 没有那个文件或目录


想要解决这个问题可以使用以下命令打开.bashrc文件,将文件末尾的多余的几条source语句删除即可(只留下一条)

$sudo gedit .bashrc

猜你喜欢

转载自blog.csdn.net/zhangjiali12011/article/details/78822043