module documentation

Warning: do not use this library. It is unstable and most of the routines here have been superseded by other libraries (e.g. rospkg). These routines will likely be deleted in future releases.

Exception InvalidROSPkgException Exception that indicates that a ROS package does not exist
Exception MultipleNodesException Exception that indicates that multiple ROS nodes by the same name are in the same package.
Exception ROSPkgException Base class of package-related errors.
Function find_node Warning: unstable API due to catkin.
Function find_resource Warning: unstable API due to catkin.
Function get_dir_pkg Get the package that the directory is contained within. This is determined by finding the nearest parent manifest.xml file. This isn't 100% reliable, but symlinks can fool any heuristic that relies on ROS_ROOT...
Function get_pkg_dir Locate directory package is stored in. This routine uses an internal cache.
Function get_pkg_subdir if it does not exist. An exception will be raised if this fails.
Function list_pkgs_by_path List ROS packages within the specified path.
Function resource_file string constants, e.g. MSG_DIR
Constant MANIFEST_FILE Undocumented
Constant PACKAGE_FILE Undocumented
Constant SRC_DIR Undocumented
Function _executable_filter Undocumented
Function _find_resource subroutine of find_resource
Function _get_pkg_subdir_by_dir if it does not exist. An exception will be raised if this fails.
Function _invalidate_cache Undocumented
Function _read_rospack_cache Read in rospack_cache data into cache. On-disk cache specifies a ROS_ROOT and ROS_PACKAGE_PATH, which must match the requested environment.
Function _update_rospack_cache Internal routine to update global package directory cache
Variable _pkg_dir_cache Undocumented
def find_node(pkg, node_type, rospack=None):

Warning: unstable API due to catkin.

Locate the executable that implements the node

Parameters
pkgUndocumented
node_typetype of node, str
rospackUndocumented
Returns
path to node or None if node is not in the package str
Raises
Unknown exceptionrospkg.ResourceNotFound` If package does not exist
def find_resource(pkg, resource_name, filter_fn=None, rospack=None):

Warning: unstable API due to catkin.

Locate the file named resource_name in package, optionally matching specified filter. find_resource() will return a list of matches, but only for a given scope. If the resource is found in the binary build directory, it will only return matches in that directory; it will not return matches from the ROS_PACKAGE_PATH as well in this case.

Parameters
pkgUndocumented
resource_nameUndocumented
filter_fnUndocumented
rospackrospkg.RosPack instance to use
filterfunction that takes in a path argument and returns True if the it matches the desired resource, fn(str)
Returns
lists of matching paths for resource within a given scope, [str]
Raises
Unknown exceptionrospkg.ResourceNotFound If package does not exist
def get_dir_pkg(d):

Get the package that the directory is contained within. This is determined by finding the nearest parent manifest.xml file. This isn't 100% reliable, but symlinks can fool any heuristic that relies on ROS_ROOT. @param d: directory path @type d: str @return: (package_directory, package) of the specified directory, or None,None if not in a package @rtype: (str, str)

def get_pkg_dir(package, required=True, ros_root=None, ros_package_path=None):

Locate directory package is stored in. This routine uses an internal cache.

NOTE: cache does not rebuild if packages are relocated after this process is initiated.

@param package: package name @type package: str @param required: if True, an exception will be raised if the package directory cannot be located. @type required: bool @param ros_root: if specified, override ROS_ROOT @type ros_root: str @param ros_package_path: if specified, override ROS_PACKAGE_PATH @type ros_package_path: str @return: directory containing package or None if package cannot be found and required is False. @rtype: str @raise InvalidROSPkgException: if required is True and package cannot be located

def get_pkg_subdir(package, subdir, required=True, env=None):

@param required: if True, will attempt to create the subdirectory
if it does not exist. An exception will be raised if this fails.

@type required: bool @param package: name of package @type package: str @param env: override os.environ dictionary @type env: dict @param required: if True, directory must exist @type required: bool @return: Package subdirectory if package exist, otherwise None. @rtype: str @raise InvalidROSPkgException: if required is True and directory does not exist

def list_pkgs_by_path(path, packages=None, cache=None, env=None):

List ROS packages within the specified path.

Optionally, a cache dictionary can be provided, which will be updated with the package->path mappings. list_pkgs_by_path() does NOT returned cached results -- it only updates the cache.

@param path: path to list packages in @type path: str @param packages: list of packages to append to. If package is

already present in packages, it will be ignored.

@type packages: [str] @param cache: (optional) package path cache to update. Maps package name to directory path. @type cache: {str: str} @return: complete list of package names in ROS environment. Same as packages parameter. @rtype: [str]

def resource_file(package, subdir, resource_name):

@param subdir: name of subdir -- these should be one of the
string constants, e.g. MSG_DIR

@type subdir: str @return: path to resource in the specified subdirectory of the

package, or None if the package does not exists

@rtype: str @raise roslib.packages.InvalidROSPkgException: If package does not exist

MANIFEST_FILE: str =

Undocumented

Value
'manifest.xml'
PACKAGE_FILE: str =

Undocumented

Value
'package.xml'
SRC_DIR: str =

Undocumented

Value
'src'
def _executable_filter(test_path):

Undocumented

def _find_resource(d, resource_name, filter_fn=None):

subroutine of find_resource

def _get_pkg_subdir_by_dir(package_dir, subdir, required=True, env=None):

@param required: if True, will attempt to create the subdirectory
if it does not exist. An exception will be raised if this fails.

@type required: bool @param package_dir: directory of package @type package_dir: str @param subdir: name of subdirectory to locate @type subdir: str @param env: override os.environ dictionary @type env: dict @param required: if True, directory must exist @type required: bool @return: Package subdirectory if package exist, otherwise None. @rtype: str @raise InvalidROSPkgException: if required is True and directory does not exist

def _invalidate_cache(cache):

Undocumented

def _read_rospack_cache(cache, ros_root, ros_package_path):

Read in rospack_cache data into cache. On-disk cache specifies a ROS_ROOT and ROS_PACKAGE_PATH, which must match the requested environment.

@param cache: empty dictionary to store package list in.
If no cache argument provided, will use internal _pkg_dir_cache and will return cached answers if available. The format of the cache is {package_name: dir_path, ros_root, ros_package_path}.

@type cache: {str: str, str, str} @param ros_package_path: ROS_ROOT value @type ros_root: str @param ros_package_path: ROS_PACKAGE_PATH value or '' if not specified @type ros_package_path: str @return: True if on-disk cache matches and was loaded, false otherwise @rtype: bool

def _update_rospack_cache(env=None):

Internal routine to update global package directory cache

@return: True if cache is valid @rtype: bool

_pkg_dir_cache: dict =

Undocumented