0
$\begingroup$

Rosanswers logo

My Hydro package includes both a launch file and a pair of yaml files. The launch file gets installed by Catkin to ~/workspace/install/share/pkg-name/file.launch (CATKIN_PACKAGE_SHARE_DESTINATION) and the parameter files to ~/workspace/install/etc/pkg-name/files.yaml (CATKIN_PACKAGE_ETC_DESTINATION).

The trouble is that roslaunch doesn't seem to know to look for the parameter files there ($(find pkg-name) resolves to ~/workspace/install/share/pkg-name). I have two fixes, but both feel like hacks and workarounds:

  1. Install the yaml files to CATKIN_PACKAGE_SHARE_DESTINATION with the launch file.

  2. Use < rosparam file="$(find pkg-name)/../../etc/pkg-name/file.yaml command="load" /> in the launch file

The first option has me wondering why there is a CATKIN_PACKAGE_ETC_DESTINATION if it isn't for param files. The second is ugly and potentially brittle.

How can I make roslaunch find my parameter files more cleanly? What is the ROS/catkin standard method/location for installing parameter files?


Originally posted by Nathan Powel on ROS Answers with karma: 3 on 2014-02-02

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Any resource file should have the same relative path from the package.xml file- either in the source package as well as in the install space.

E.g. keep the files in somewhere/myfile in your source repo and install them to $(CATKIN_PACKAGE_SHARE_DESTINATION}/somewhere/myfile.

That way your launch file can reference it with $(find pkg-name/somewhere/myfile which will work in devel space as well as after installation.

You should definitely not use relative paths with .. and "escape" the package folder since that would not work without installing the package.


Originally posted by Dirk Thomas with karma: 16276 on 2014-02-02

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by Nathan Powel on 2014-02-02:
I guess that does seem more organized if the relative path structure is preserved, which I had not done even for the launch file. That still leaves me with wondering what would properly go in CATKIN_PACKAGE_ETC_DESTINATION.

Comment by mikepurvis on 2014-02-04:
You can get a package's etc directory using catkin's Python API, so it's possible to load files from it at runtime: http://docs.ros.org/hydro/api/catkin/html/_modules/catkin/find_in_workspaces.html

Comment by mikepurvis on 2014-02-04:
I don't think there's a C++ API for it, though; the lack of availability of the etc path to roslaunch is definitely a problem. Dirk attempted to address it here, but the pull request was never merged: https://github.com/ros/ros_comm/pull/228

$\endgroup$

Your Answer

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