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 | |
Exception that indicates that a ROS package does not exist |
| Exception | |
Exception that indicates that multiple ROS nodes by the same name are in the same package. |
| Exception | |
Base class of package-related errors. |
| Function | find |
Warning: unstable API due to catkin. |
| Function | find |
Warning: unstable API due to catkin. |
| Function | get |
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 |
Locate directory package is stored in. This routine uses an internal cache. |
| Function | get |
if it does not exist. An exception will be raised if this fails. |
| Function | list |
List ROS packages within the specified path. |
| Function | resource |
string constants, e.g. MSG_DIR |
| Constant | MANIFEST |
Undocumented |
| Constant | PACKAGE |
Undocumented |
| Constant | SRC |
Undocumented |
| Function | _executable |
Undocumented |
| Function | _find |
subroutine of find_resource |
| Function | _get |
if it does not exist. An exception will be raised if this fails. |
| Function | _invalidate |
Undocumented |
| Function | _read |
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 |
Internal routine to update global package directory cache |
| Variable | _pkg |
Undocumented |
Warning: unstable API due to catkin.
Locate the executable that implements the node
| Parameters | |
| pkg | Undocumented |
| node | type of node, str |
| rospack | Undocumented |
| Returns | |
| path to node or None if node is not in the package str | |
| Raises | |
Unknown exception | rospkg.ResourceNotFound` If package does not exist |
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 | |
| pkg | Undocumented |
| resource | Undocumented |
| filter | Undocumented |
| rospack | rospkg.RosPack instance to use |
| filter | function 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 exception | rospkg.ResourceNotFound If package does not exist |
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)
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
- @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
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]
- @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
- @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
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