Ask Your Question
0

Directory of executables of ROS nodes compiled with Catkin

asked 2015-01-04 22:45:06 -0500

Alexandre.Willame gravatar image

I have built ROS node that uses openCV and that needs to load some specific files during execution. The files need to be in the 'current directory' in usual OpenCV implementation, which I believe is the directory of the compiled ROS nodes.

  • Is that correct?
  • Where is it located?

The exact code I am talking about can be found on the link given above, where two files, "haarcascade_frontalface_alt.xml" and "haarcascade_eye_tree_eyeglasses.xml" have to be loaded by the instructions

face_cascade.load( face_cascade_name )
eyes_cascade.load( eyes_cascade_name )
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
4

answered 2015-01-05 01:12:28 -0500

Wolf gravatar image

The executables are saved in the folder <catkin_ws>/devel/lib . However, if you wish to load some other files in your code (what you intent to do) this does not matter. I you use relative pathes for the file you load they need ot be somewhere relatively to your current working directory, i. e. the folder in which your call rosrun like rosrun your_pkg your_node. rosrun automatically locates your executables and runs them in the folder where you call rosrun.

Addition: If you use roslaunch your current working directory, i. e. the folder where your nodes run, will always be <home>/.ros, regardless where it is called....

edit flag offensive delete link more
2

answered 2015-01-05 07:38:55 -0500

kmhallen gravatar image

You could load using a path relative to your package.
http://wiki.ros.org/Packages#C.2B-.2B-

face_cascade.load( ros::package::getPath("some_package") + face_cascade_name );
edit flag offensive delete link more

Comments

1

The string returned by getPath() might not contain a trailing slash so watch out when concatenating it.

Dirk Thomas gravatar imageDirk Thomas ( 2015-01-05 15:26:55 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2015-01-04 22:45:06 -0500

Seen: 453 times

Last updated: Jan 05 '15