0
$\begingroup$

Rosanswers logo

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-


Originally posted by 2ROS0 on ROS Answers with karma: 1133 on 2018-11-15

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by gvdhoorn with karma: 86574 on 2018-11-16

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by 2ROS0 on 2018-11-16:
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?

Comment by gvdhoorn on 2018-11-16:
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.

$\endgroup$

Your Answer

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