1、gedit ~/.bashrc或者vm ~/.bashrc
2、在最后一行加上
source /home/riki/catkin_ws/devel/setup.bash (其中catkin_ws为自己工作空间的名字)波浪号为根目录
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/riki/catkin_ws/
最好用绝对路径
保存退出
3、source ~/.bashrc
cd ~/catkin_ws 进入到工作空间里,然后
source devel/setup.bash
4、echo $ROS_PACKAGE_PATH 即可看到自己的工作空间路径