[ros-users] catkin_make convenience improvements

Thibault Kruse kruset at in.tum.de
Tue Feb 5 23:16:22 UTC 2013


On 02.02.2013 01:58, Tommy Persson wrote:
> 4. Putting Python script information (according to some webpag) in 
> setup.py will install it in devel and the script will be available in 
> the path (and included python modules will be found) after just make. 
> But C++-binaries have to be run with rosrun. So what is the intended 
> work flow here? Was it wrong of me to install the Python scrips in 
> devel? But if I did not do that I could not find the module files that 
> was included.
I'll respond to this here as it relates to currently misleading documention.

You have done exactly what the docs said, but the docs should have told 
you differently. Python scripts for ROS should in general be runnable 
with rosrun, so they should not go into bin. Putting them into setup.py 
as "scripts" will put them in the wrong place.
Instead, you may use cmake like this:

install(TARGETS scripts/foo_script
         DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

This will not put anything in the devel space, which is okay because 
rosrun looks into the source folder as well.
Still you'd need to declare python packages in the setup.py, but then 
those should be found, after sourcing devel/setup.*sh
That's how groovy catkin packages have done it so far.


A second possibility is to declare such scripts as data_files in the 
setup.py files, like this:

setup(
     ...
     data_files=[('lib/my_foo_package', ['scripts/foo', 'nodes/bar'])])

We'll probably make this the recommended way, but this solution is not 
totally clean and confirmed yet, and will probably be made a bit more 
convenient to type.

The discussion can be followed at the Buildsystem SIG here:
https://groups.google.com/d/topic/ros-sig-buildsystem/hsxeJocnKIQ/discussion
That's also the best place to respond to this post.

cheers,
   Thibault



More information about the ros-users mailing list