Hi Geof,
Sorry my last emails was a little bit hurried and was mostly a reply to ongoing discussions with Thibault.
For clarity we've been trying to use as standard a toolchain as possible. This allows us to leverage the mature standard tools. For example, rospy being a pure python package can be written as a pure python project, with setup.py. To be able to integrate into the larger system we do require package.xml and a minimal boilerplate cmake file.
The required CMakeLists.txt is:
{{{
cmake_minimum_required(VERSION 2.8.3)
project(rospy)
find_package(catkin REQUIRED)
catkin_package()
catkin_python_setup()
}}}
If you read the file in rospy there are some extra lines below for backwards compatibility with rosbuild, but those are not necessary for most packages.
The setup.py for rospy reads like this:
{{{
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['rospy', 'rospy.impl'],
package_dir={'': 'src'},
requires=['genpy', 'numpy', 'rosgraph', 'roslib', 'rospkg']
)
setup(**d)
}}}
Where d evaluates to:
{{{
{'author': u'Ken Conley',
'description': 'rospy is a pure Python client library for ROS. The rospy client\n API enables Python programmers to quickly interface with ROS <a href="http://ros.org/wiki/Topics">Topics</a>, <a href="http://ros.or',
'license': 'BSD',
'long_description': 'rospy is a pure Python client library for ROS. The rospy client\n API enables Python programmers to quickly interface with ROS <a href="http://ros.org/wiki/Topics">Topics</a>, <a href="http://ros.org/wiki/Services">Services</a>, and <a href="http://ros.org/wiki/Parameter Server">Parameters</a>. The\n design of rospy favors implementation speed (i.e. developer\n time) over runtime performance so that algorithms can be quickly\n prototyped and tested within ROS. It is also ideal for\n non-critical-path code, such as configuration and initialization\n code. Many of the ROS tools are written in rospy to take\n advantage of the type introspection capabilities.\n\n Many of the ROS tools, such\n as <a href="http://ros.org/wiki/rostopic">rostopic</a>\n and <a href="http://ros.org/wiki/rosservice">rosservice</a>, are\n built on top of rospy.',
'maintainer': u'Dirk Thomas',
'maintainer_email': 'dth...@willowgarage.com',
'name': 'rospy',
'package_dir': {'': 'src'},
'packages': ['rospy', 'rospy.impl'],
'requires': ['genpy', 'numpy', 'rosgraph', 'roslib', 'rospkg'],
'url': 'http://ros.org/wiki/rospy',
'version': '1.9.39'}
}}}
In this way there's a convenient way to avoid duplicating data between the package.xml and the setup.py file.
In the CMakeLists.txt you can see the one line to tell catkin that this package has a setup.py file. And from that catkin can invoke setup.py with the right arguments to install packages into the right places, and distutils takes care of all the heavy lifting. Things like the logic for setting the path to install into based on what version of python you're using, don't need to be replicated. And after it's installed the only requirement to use the python library is to set the PYTHONPATH to the installed directory, which catkin builds into the setup.(ba)sh files as well. This way to convert a pure python package from catkin to pip based installation, or the reverse, it's just a requirement to add or remove the short CMakeLists.txt boilerplate and a packages.xml. To convert into a catkin package you don't even need to switch to uses the catkin_pkg helper function if you don't want, you can keep using the fully written out setup.py.
Likewise on the C++ side we're leveraging CMake as much as possible. We've added helper methods on top to automate the most boring code and package metadata related to managing multiple packages. But the end result is to let cmake do the majority of the work. This means that much less of the code is custom and the standard tools can be relied on for a larger part of the system. Catkin packages, once installed, can be used from any cmake project by simply using the FindPackage infrastructure, automatically generated by catkin, meaning that it is not even necessary to use catkin to build on top of catkin packages.
This is getting longer than I planned. But I hope it's a little more clear about the design intentions.
Tully