**
ROS Kinetic 创建工作空间
**
主要参考:
https://blog.csdn.net/youshijian99/article/details/79924016
1.检查环境变量设置printenv | grep ROS
yl@yl-Lenovo-XiaoXin-CHAO5000:~$ printenv | grep ROS
ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/opt/ros/kinetic/share
ROS_MASTER_URI=http://localhost:11311
ROS_PYTHON_VERSION=2
ROS_VERSION=1
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=kinetic
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros
2.创建工作空间mkdir -p ~/catkin_ws/src
3.初始化工作空间catkin_init_workspace
yl@yl-Lenovo-XiaoXin-CHAO5000:~$ mkdir -p ~/catkin_ws/src
yl@yl-Lenovo-XiaoXin-CHAO5000:~$ catkin_init_workspace
Creating symlink "/home/yl/CMakeLists.txt" pointing to "/opt/ros/kinetic/share/catkin/cmake/toplevel.cmake"
4.进入工作空间cd ~/catkin_ws/
5.编译工作空间catkin_make
yl@yl-Lenovo-XiaoXin-CHAO5000:~$ cd ~/catkin_ws/
yl@yl-Lenovo-XiaoXin-CHAO5000:~/catkin_ws$ catkin_make
Base path: /home/yl/catkin_ws
Source space: /home/yl/catkin_ws/src
Build space: /home/yl/catkin_ws/build
Devel space: /home/yl/catkin_ws/devel
Install space: /home/yl/catkin_ws/install
6.查看环境变量echo $ROS_PACKAGE_PATH
7.设置环境变量
下载vimsudo apt install vim
打开vimvim ~/.bashrc
输入i,左下叫会显示插入
在最后输入source /home/yl/catkin_ws/devel/setup.bash
(注意:yl需要针对不同的电脑设置而变化,是工作空间路径的一部分)
:wq为保存并退出命令
yl@yl-Lenovo-XiaoXin-CHAO5000:~/catkin_ws$ cd ..
yl@yl-Lenovo-XiaoXin-CHAO5000:~$ sudo apt install vim
8.检查环境变量
进入工作空间cd ~/catkin_ws/
检查环境变量echo $ROS_PACKAGE_PATH
yl@yl-Lenovo-XiaoXin-CHAO5000:~$ cd ~/catkin_ws/
yl@yl-Lenovo-XiaoXin-CHAO5000:~/catkin_ws$ echo $ROS_PACKAGE_PATH
文章评论