将ros功能包制作成deb格式发布

1.安装bloom
 sudo apt-get install python-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/*.*")
 #openag_script_file为目标文件   
   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
)


     2)如果需要在安装过程中开放launch文件或include文件夹

install(DIRECTORY launch/
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
  PATTERN ".svn" EXCLUDE)

      3)执行下面两条命令生成deb文件

$ 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)

#install config yaml files
install(DIRECTORY config/
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config
  PATTERN ".svn" EXCLUDE)

        2)执行以下命令

$ bloom-generate rosdebian --os-name ubuntu --ros-distro indigo
$ fakeroot debian/rules binary


4.安装deb文件

  在deb目录下执行:sudo dpkg -i *.deb

5.卸载

  sudo dpkg -r  ros-indigo-*即可

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
 

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值