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

How include resources in catkin package script?

asked 2015-11-07 09:48:28 -0600

Hieronix gravatar image

Suppose that I have a package "mypack" and at "mypack\scripts" there are python scripts and at "mypack\scripts\resources" there are some files (.png, .txt, etc) that are used by my script. Is there a way to import these resources without need FULL path (\home\user\catkin\src\mypack\scripts\resources\file)?

Obs. Relative path (\resources\file) only works when I use ROSRUN inside scripts, ROSLAUNCH don't.

To solve this I import rospkg and get the package path (\home\user\catkin\src\mypack) + "\scripts\resources", but I would like to know if there is a more pythonic way to do this.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-07-04 06:15:34 -0600

MartinK gravatar image

You could have a look at the roslib.package example. It contains examples for both python adn C++. So for python: roslib.packages.get_pkg_dir('mypack')

edit flag offensive delete link more

Question Tools



Asked: 2015-11-07 09:48:28 -0600

Seen: 813 times

Last updated: Nov 07 '15