Ask Your Question
0

Using ros package for filepaths

asked 2018-11-15 17:59:33 -0500

2ROS0 gravatar image

updated 2018-11-15 18:00:50 -0500

Hi,

I came across this method for loading files in a ros node. In this particular instance the file was a calibration yaml file like so:

ci_manager->loadCameraInfo("package://camera_drivers/resource/calibration/2017_12_101.yaml");

Where does the package:// command search for? How can I add other packages to this list?

Thank you.

edit: I found this other method of potentially doing the same thing? http://wiki.ros.org/Packages#C.2B-.2B-

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-11-16 03:09:43 -0500

gvdhoorn gravatar image

updated 2018-11-16 03:49:33 -0500

I came across this method for loading files in a ros node. In this particular instance the file was a calibration yaml file like so:

ci_manager->loadCameraInfo("package://camera_drivers/resource/calibration/2017_12_101.yaml");

Where does the package:// command search for?

This is not a command, it's a protocol, which makes package://.... a form of URI.

In the end, such URIs can be used with packages such as resource_retriever:

This package retrieves data from url-format files such as http://, ftp://, package:// file://, etc., and loads the data into memory. The package:// url for ros packages is translated into a local file:// url. The resourse retriever was initially designed to load mesh files into memory, but it can be used for any type of data. The resource retriever is based on the the libcurl library.

Other packages in ROS also support this.

How can I add other packages to this list?

There is no specific list for this: all packages on the ROS_PACKAGE_PATH are considered when parsing these URIs.

So any ROS package in your Catkin workspace, packages in underlay workspaces and packages in the regular /opt/ros/.. locations will be considered.


Edit: it seems this functionality was implemented in camera_info_manager in a slightly different way, see these lines for instance.

edit flag offensive delete link more

Comments

Thanks, that helps! Quick clarification, if I have my package location on ROS_PACKAGE_PATH but am not using catkin, just plain cmake. What then makes it a "ros package"? Or can it still be found using package:// without catkin?

2ROS0 gravatar image 2ROS0  ( 2018-11-16 11:03:54 -0500 )edit
1

Any directory with a package.xml is considered a ROS package.

Note though: the further you try to "stray" from the regular ROS pkg layout and conventions, the more tools will start to break.

gvdhoorn gravatar image gvdhoorn  ( 2018-11-16 11:05:25 -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

1 follower

Stats

Asked: 2018-11-15 17:59:33 -0500

Seen: 168 times

Last updated: Nov 16 '18