tzy@ubuntu:~$ mkdir -p ROS_Example/catkin_ws/src
tzy@ubuntu:~$ cd ROS_Example/catkin_ws/
tzy@ubuntu:~/ROS_Example/catkin_ws$ catkin_make
以上指令等價于
catkin_ws目錄下會生成以下三個檔案夾
tzy@ubuntu:~/ROS_Example/catkin_ws$ ls
build devel src
src下的CMakeLists是軟連結
tzy@ubuntu:~/ROS_Example/catkin_ws$ ll src/CMakeLists.txt
lrwxrwxrwx 1 tzy tzy 50 Oct 27 17:10 src/CMakeLists.txt -> /opt/ros/kinetic/share/catkin/cmake/toplevel.cmake
tzy@ubuntu:~/ROS_Example/catkin_ws$ source devel/setup.bash
要保證工作區被安裝腳本正确覆寫,需确定ROS_PACKAGE_PATH環境變量包含你目前的工作空間目錄:
tzy@ubuntu:~/ROS_Example/catkin_ws$ echo $ROS_PACKAGE_PATH
/home/tzy/ROS_Example/catkin_ws/src:/opt/ros/kinetic/share
現在使用catkin_create_pkg指令建立一個名為beginner_tutorials的新軟體包,這個軟體包依賴于std_msgs、roscpp和rospy這3個包
tzy@ubuntu:~/ROS_Example/catkin_ws$ catkin_create_pkg beginner_tutorials std_msgs rospy roscpp
Created file beginner_tutorials/CMakeLists.txt
Created file beginner_tutorials/package.xml
Created folder beginner_tutorials/include/beginner_tutorials
Created folder beginner_tutorials/src
Successfully created files in /home/tzy/ROS_Example/catkin_ws/beginner_tutorials. Please adjust the values in package.xml.
std_msgs對于ROS來說也是一個軟體包,可以用操作軟體包的指令進行檢視
tzy@ubuntu:~/ROS_Example/catkin_ws$ rosls std_msgs/
cmake msg package.xml
tzy@ubuntu:~/Desktop$ roscd std_msgs
tzy@ubuntu:/opt/ros/kinetic/share/std_msgs$ ls
std_msgs包對應的原始代碼連結
GitHub - ros/std_msgs: Contains minimal messages of primitive data types and multiarrays. Intended for quick prototyping, not production use.