ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The summaries that you provided are correct, and seem to me to accurately describe the purpose of both tools. Your assertion that they do similar things is correct, but the situations where you would use one or the other is quite different.
The most common use of rospack
is (as stated) a command line tool. If you are trying to figure out what dependencies you might be missing to use a package, if you wanted to understand what plugins a package exports, or if you wanted to see where a package is installed, all of these questions could be answered with rospack
at the command line.
rospkg
on the other hand would likely not be directly used by a developer to answer queries, but would instead be incorporated directly into a Python script to provide functionality that depends on querying information about installed ROS packages. I've occasionally seen people use this capability in writing installation or setup scripts that support a ROS project, but the more common place I've seen this is to find out the paths to a package within a node. For example, let's say you wanted to read a config file in Python that you knew was in a package's directory, then you could use rospkg
to automatically get the path to the package's root directory and find that config file in a portable way.
Hope that helps!