ROS stack access¶
The RosStack
classes provides APIs similar to the
rosstack
command-line tool distributed with ROS. Like
rosstack
, it provides information about stack dependency
information, filesystem locations, and manifest access. The Python API
is more efficient than shelling out to rosstack
as it provides
caching and other optimizations for repeated querying.
-
rospkg.
STACK_FILE
¶ Name of stack manifest file, i.e. ‘stack.xml’.
-
class
rospkg.
RosStack
([ros_paths=None])[source]¶ Query information about ROS stacks on the local filesystem. This includes information about dependencies, retrieving stack
Manifest
instances, and determining the contents of stacks.RosStack
can be initialized with the default environment, or its environment configuration can be overridden with alternate ROS path settings.NOTE: for performance reasons,
RosStack
caches information about stacks.NOTE 2:
RosStack
is not thread-safe.- Parameters
ros_paths – Ordered list of paths to search for resources. If None (default), use environment ROS path.
-
get_ros_paths
() → [str]¶ Get ROS paths of this instance
-
ros_paths
¶ Get ROS paths of this instance
-
get_manifest
(name) → Manifest¶ Get the
Manifest
of the specified package.- Parameters
name – package name,
str
- Raises
InvalidManifest
-
list
() → [str]¶ List stacks.
- Returns
complete list of package names in ROS environment
-
get_path
(name) → str¶ - Parameters
name – stack name,
str
- Returns
filesystem path of stack
- Raises
-
get_depends
(name[, implicit=True]) → [str]¶ Get explicit and implicit dependencies of a stack.
- Parameters
name – stack name,
str
implicit – include implicit (recursive) dependencies,
bool
- Returns
list of names of dependencies.
- Raises
InvalidManifest
-
get_depends_on
(name[, implicit=True]) → [str]¶ Get list of stacks that depend on a stack. If implicit is
True
, this includes implicit (recursive) dependency relationships.- Parameters
name – stack name,
str
implicit – include implicit (recursive) dependencies,
bool
- Returns
list of names of dependencies,
[str]
- Raises
InvalidManifest
-
packages_of
(stack) → [str][source]¶ - Returns
name of packages that are part of stack
- Raises
ResourceNotFound
if stack cannot be located
-
rospkg.
expand_to_packages
(names, rospack, rosstack)[source]¶ Expand names into a list of packages. Names can either be of packages or stacks.
- Parameters
- Returns
([packages], [not_found]).
expand_packages()
returns two lists. The first is of packages names. The second is a list of names for which no matching stack or package was found. Lists may have duplicates.