ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Depending on your programming language there is API to get the path of your package which is the directory containing the package.xml file: see https://wiki.ros.org/Packages#Client_Library_Support

Python:

import rospkg
rospack = rospkg.RosPack()
rospack.get_path('your_package_name')

C++:

#include <ros/package.h>
std::string path = ros::package::getPath("your_package_name");

And in your case the relative path of resources is the same so you should be easily able to construct the path you want which works for both cases - the devel / src as well as the install space.