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.