0
$\begingroup$

Rosanswers logo

How do you include and customize a third party ROS package without literally copying the files into your catkin workspace?

All the docs I see for adding pre-built packages to your project say to checkout the package into your workspace, but this feels wasteful and prone to maintenance problems, since you're forced to now maintain a fork of the original project add your custom configurations directly to it, making upstream merges potentially difficult.

Is that really the standard practice or is there a better way?


Originally posted by Cerin on ROS Answers with karma: 940 on 2016-03-16

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

(1) If the upstream package can be installed from apt-get, you can find_package the respective package in your CMakeLists.txt and use the exported libraries and headers in your code.

(2) If you only want to configure a package, simply create a new package containing the respective launch and config files.

(3) If you, however, want to customize a package, i.e. changing the code, there is no other way then to clone it to your workspace. You should try to bring your changes upstream as fast as possible, if they are general and can be useful to the community.

If option (1) and (2) don't suit your needs, you will need to use option (3) with the potential maintenance problems you mentioned.


EDIT

again three options:

(1) put the source in the same workspace as your package (you can have multiple repos etc. therein)

(2) create a chained/overlayed workspace, where you put your package in the one which is highest in the hierarchy and the other in the underlay

(3) you can also install packages using catkin_make -DCMAKE_INSTALL_PREFIX=/opt/ros/indigo install, but there might be some performance issues. Check out this page for more info (about in the middle of the page).

I personally would go for option (2) and wouldn't touch option (3) unless you'd really know what you are doing...


Originally posted by mgruhler with karma: 12390 on 2016-03-16

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Cerin on 2016-03-16:
I think I'm looking at option 2. However, what if the package isn't installable from apt-get, but the source is publicly accessible from github or elsewhere? How would you install it outside your workspace where catkin can still find it?

Comment by mgruhler on 2016-03-16:
see edit above

Comment by Cerin on 2016-03-16:
What about putting third-party packages in an arbitrary folder outside my workspace and then append that path to my ROS_PACKAGE_PATH as outlined here?

Comment by mgruhler on 2016-03-16:
This is basically option (2). Better use the overlay structure instead of manually manipulating the ROS_PACKAGE_PATH.

I.e. if you are using catkin. For the legacy rosbuild, this was the way to go.

Comment by ahendrix on 2016-03-16:
That tutorial is outdated and only applies to rosbuild packages. You can't use catkin packages just by modifying your ROS_PACKAGE_PATH.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.