Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here's an example in Python

from rospkg import RosPack


def find_abs_pkg_path(pkg_name):
    """Returns the absolute path of the package with name pkg_name."""

    # Get an instance of RosPack with the default search paths
    ros_pack = RosPack()
    return ros_pack.get_path(pkg_name)


if __name__ == '__main__':
    PKG_PATH = find_abs_pkg_path("my_package")
    print "path of ROS package my_package", PKG_PATH