rospkg Python module provides basic utilities for querying
information about ROS packages, stacks, and distributions. There are
several basic APIs: ROS environment,
RosStack, OS detection, and distributions.
The environment APIs enable access to environment settings that define
the ROS package/stack filesystem configuration. The
RosStack APIs are similar to the
rosstack command-line tools and provide information about
dependency, location, and other package/stack metadata. The
Manifest class provides access to a specific package/stack’s
manifest information. NOTE: the
Manifest class API is still
volatile. Where possible, use the relevant
RosStack APIs to access manifest-related
information instead (e.g. dependency relationships).
rospkg.distro sub-module provides access to ROS
distribution files, which describe collections of ROS stacks releases.
This API is module is still unstable and mainly supports internal
import rospkg ros_root = rospkg.get_ros_root() r = rospkg.RosPack() depends = r.get_depends('roscpp') path = r.get_path('rospy')
Requested resource (e.g. package/stack) could not be found.
Version of this module.
Recommended automated installation¶
rospkg is already a dependency of many core packages of ROS, so it should get automatically installed when you follow standard installation steps.
Automated installation is realized by adding a dependency like this:
package.xml format 1:
rospkg is available on pypi and can be installed via
pip install -U rospkg
easy_install -U rospkg
For debian-based OSes it’s available via apt.
apt-get install python-rospkg
rospkg module is meant to be used as a normal Python
module. After it has been installed, you can
import it normally
and do not need to declare as a ROS package dependency.