ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Roslaunch and etc/pkg-name for yaml files

asked 2014-02-02 07:39:37 -0500

Nathan Powel gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-02-02 08:05:56 -0500

Dirk Thomas gravatar image

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.

edit flag offensive delete link more


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.

Nathan Powel gravatar image Nathan Powel  ( 2014-02-02 10:45:48 -0500 )edit

You can get a package's `etc` directory using catkin's Python API, so it's possible to load files from it at runtime:

mikepurvis gravatar image mikepurvis  ( 2014-02-04 02:44:03 -0500 )edit

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:

mikepurvis gravatar image mikepurvis  ( 2014-02-04 02:45:33 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2014-02-02 07:39:37 -0500

Seen: 746 times

Last updated: Feb 02 '14