Generate deb installable package from ROS Package

本文详细介绍了如何将ROS包打包成Debian安装文件。首先,以beginner_tutorial为例,演示如何为Python和C++文件生成deb包,并安装到Ubuntu系统中。然后,针对RoboteQ ROS包,解释了如何处理依赖并生成相应的Debian包。通过这些步骤,可以方便地分发和安装ROS包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >



Generate deb installable package from ROSPackage

 

Section 1, Package beginner_tutorial into Debian File

This tutorial assumesyou have already created the ros beginner_tutorial package by following the ROSbeginner tutorial(http://wiki.ros.org/ROS/Tutorials). You can also refer to the zipped packagefiles which is beginner_tutorials.tar.gz and beginner_tutorials_cpp.tar.gz, andexperiment with it.

Install Python files using deb

In the beginner_tutorialsROS package folder, the tree structure of the folder is as following:

 

To add the pythonsource code files to the deb, you need to add following lines to theCMakeLists.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/*.*")
 
#The following code block will install python file which in the openag_script_#files to the destination folder. About the Macro, catkin_install_python, ple#ase refer: http://docs.ros.org/jade/api/catkin/html/howto/format2/installing#_python.html
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")
 
 

 

If you don’t add thecode above to the CMakeLists.txt file, your deb file do not contain the pythonexecutable files. After install the deb, the python executable files will NOTbe installed on your machine.

Another alternative wayof install python script files in the deb file, it is writing following macros.It has the same effect as catkin_install_python:

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} wh
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值