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