1.安装bloom
2.将python文件制作成deb包
1) 修改CMakeLists.txt:
FILE(GLOB openag_script_files "${CMAKE_CURRENT_SOURCE_DIR}/script/*.*") # This line #will give the variable, openag_script_files, value of each file in the scrip#t folder
FILE(GLOB openag_subdirectory_script_files "${CMAKE_CURRENT_SOURCE_DIR}/script/srv/*.*")
catkin_install_python(PROGRAMS ${openag_script_files} DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) # The following code block will install python file which in the openag_script_files to# the destination folder catkin_install_python(PROGRAMS ${openag_subdirectory_script_files} DESTINATION "${CATKIN_PACKAGE_BIN_DESTINATION}/srv")或者执行以下操作:
install(PROGRAMS script/listener.py script/talker.py script/add_two_ints_client.py script/add_two_ints_server.py DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} ) # The installation destination of python executable file is ${CATKIN_PACKAGE_SHARE_DE#STINATION} which is /opt/ros/kinetic/lib/ #If after you install the deb, the rosrun can’t find the python executable. Then chan#ge this destination to ${CATKIN_PACKAGE_SHARE_DESTINATION} which will install in /op#t/ros/kinetic/share/ install(PROGRAMS script/srv/_AddTwoInts.py script/srv/__init__.py DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}/srv )
install(DIRECTORY launch/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch PATTERN ".svn" EXCLUDE)
3)
$ bloom-generate rosdebian --os-name ubuntu --ros-distro indigo
$ fakeroot debian/rules binary
3.将C++文件制作成deb文件
1)修改CMakeLists.txt
# Build executable, talker, from the talk.cpp source code file add_executable(talker src/talker.cpp) target_link_libraries(talker ${catkin_LIBRARIES}) add_dependencies(talker beginner_tutorials_generate_messages_cpp) add_executable(listener src/listener.cpp) target_link_libraries(listener ${catkin_LIBRARIES}) add_dependencies(listener beginner_tutorials_generate_messages_cpp) add_executable(add_two_ints_server src/add_two_ints_server.cpp) target_link_libraries(add_two_ints_server ${catkin_LIBRARIES}) add_dependencies(add_two_ints_server beginner_tutorials_gencpp) add_executable(add_two_ints_client src/add_two_ints_client.cpp) target_link_libraries(add_two_ints_client ${catkin_LIBRARIES}) add_dependencies(add_two_ints_client beginner_tutorials_gencpp) # Add executable files, talker, listener, add_two_ints_server and add_two_ints_clie#nt to the deb file, so we can install the deb files which contains the execut#able files. install(TARGETS talker listener add_two_ints_server add_two_ints_client RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch PATTERN ".svn" EXCLUDE)
$ bloom-generate rosdebian --os-name ubuntu --ros-distro indigo $ fakeroot debian/rules binary
4.安装deb文件
在deb目录下执行:sudo dpkg -i *.deb
5.卸载
Reference:
[1]https://github.com/mikeferguson/buildbot-ros/blob/master/documentation/private_repositories.md
[2]https://answers.ros.org/question/173804/generate-deb-from-ros-package/4
[3] https://blog.csdn.net/freeleons/article/details/78279563
文章来源: 将ros功能包制作成deb格式发布