More: please pay attention to micro bloggers letter (cc806522806) or the public number (to be open), without the consent of bloggers do not reprint!
1, the creation process
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src/
catkin_init_workspace
2. Compile space
cd ~/catkin_ws/
catkin_make
3, the environment variables to take effect
source devel/setup.bash
4, to ensure that the environment variables to take effect
echo $ROS_PACKAGE_PATH
#输出:/home/luda/catkin_ws/src:/opt/ros/kinetic/share
注意:
在终端使用source命令设置的环境变量只能在当前终端中生效,如果希望环境变量在所以终端中有效,则需要在终端的配置文件中加入环境变量的设置
echo "source /WORKSPACE/devel/setup.bash" >>~/.bashrc
#将WORKSPACE替换成你自己的工作空间路径
#例如我的:echo "source /home/luda/catkin_ws/devel/setup.bash" >>~/.bashrc
5. Creating Feature Pack
cd ~/catkin_ws/src
catkin_create_pkg learning_communication std_msgs rospy roscpp
6, compiler and set the environment variable
cd ~/catkin_ws
catkin_make
source ~/catkin_ws/devel/setup.bash