For ROS experienced user, You can just skip to the Constuction about ROS Package usage:
For Quick Reference(C++): http://blog.csdn.net/sonictl/article/details/46764855#t5
For Quick Reference(Python): http://blog.csdn.net/sonictl/article/details/46764855#t15
=== 在上一篇的基础上,Create并Customize了Package之后,要Build Package ===
来源:http://wiki.ros.org/ROS/Tutorials/BuildingPackages
1. 确认source有没有完成 (版本: hydro):
$ source /opt/ros/hydro/setup.bash
2. Using catkin_make
使用方法:
# In a catkin workspace $ catkin_make [make_targets] [-DCMAKE_VARIABLES=...]这里catkin_make使用了CMake 的workflow来操作,科普一下这个workflow:
3. 如何写ROS的Publisher and Subscriber(C++)
因为要涉及到对CMakeLists.txt的写法,需要先了解这个文章:http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29
具体关于CMakeLists.txt文件,请看http://wiki.ros.org/catkin/CMakeLists.txt
4. 关于workspace下的build devel src文件夹
The build folder is the default location of thebuild space and is wherecmake andmake are called to configure and build your packages.
The devel folder is the default location of thedevel space, which is where your executables and libraries go before you install your packages.
5. Build the package
catkin_make命令执行情况如下:
exbot@ubuntu:~/catkin_ws$ ls build devel src exbot@ubuntu:~/catkin_ws$ catkin_make Base path: /home/exbot/catkin_ws Source space: /home/exbot/catkin_ws/src Build space: /home/exbot/catkin_ws/build Devel space: /home/exbot/catkin_ws/devel Install space: /home/exbot/catkin_ws/install #### #### Running command: "make cmake_check_build_system" in "/home/exbot/catkin_ws/build" #### -- Using CATKIN_DEVEL_PREFIX: /home/exbot/catkin_ws/devel -- Using CMAKE_PREFIX_PATH: /opt/ros/hydro -- This workspace overlays: /opt/ros/hydro -- Using PYTHON_EXECUTABLE: /usr/bin/python -- Python version: 2.7 -- Using Debian Python package layout -- Using CATKIN_ENABLE_TESTING: ON -- Call enable_testing() -- Using CATKIN_TEST_RESULTS_DIR: /home/exbot/catkin_ws/build/test_results -- Found gtest sources under '/usr/src/gtest': gtests will be built -- catkin 0.5.86 -- BUILD_SHARED_LIBS is on -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- ~~ traversing 7 packages in topological order: -- ~~ - beginner_tutorials -- ~~ - exbotxi_bringup -- ~~ - exbotxi_description -- ~~ - exbotxi_example -- ~~ - exbotxi_nav -- ~~ - exbotxi_rviz -- ~~ - exbotxi_teleop -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- ++