Ask Your Question
0

How can I include a package in a new folder?

asked 2012-07-01 23:46:47 -0500

Marie gravatar image

updated 2012-07-11 18:00:25 -0500

tfoote gravatar image

I have a folder Scenario that contains five packages and I would like to include this folder in another one, devel. So I would like to change the path from /home/Scenario to /home/devel/Scenario but I couldn't find any command to do that automatically. Do I need to change the path manually in every files in each package?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2012-07-01 23:53:13 -0500

ipso gravatar image

updated 2012-07-02 00:01:03 -0500

What files are you concerned about? If you didn't use any hard coded, absolute paths in any of your sources / scripts, then the location of a package should not affect its proper functioning (or building).

As long as packages are (indirectly) on your ROS_PACKAGE_PATH, things should be fine. ROS will sort out the locations of packages during building and execution, using the information in the manifest.xml file (among other things). rosmake also sets up the include paths for C++ code.

For bash scripts, use rospack: to make use of a file inside my_package in the /home/me/somedir directory, instead of doing:

do_something_with /home/me/somedir/my_package/my_file

do:

do_something_with `rospack find my_package`/my_file

this way it doesn't matter where my_package is, as long as rospack can find it.

tl;dr: stay away from absolute paths and things should 'just work'.

PS: a rosmake --pre-clean might be a good thing to do after moving them.

edit flag offensive delete link more

Comments

2

cmake hard-codes paths. When moving an already compiled ros package to a different directory, it is important to call make clean in that package before building it. rosmake --pre-clean does that in all packages in the dependency tree.

Lorenz gravatar image Lorenz  ( 2012-07-02 00:00:01 -0500 )edit

:) just added that, but thanks.

ipso gravatar image ipso  ( 2012-07-02 00:01:35 -0500 )edit
0

answered 2012-07-03 00:57:03 -0500

Marie gravatar image

I have changed the packages path and I do a rosmake --pre-clean, every thing works well.

Thanks

edit flag offensive delete link more

Comments

Please don't use answers to post. As this is a Q&A format, and not a discussion forum, posts can reorder based on up and down votes. Instead, please accept a correct answer by clicking the check mark next to it, and use the "Post a Comment" functionality for comments.

mjcarroll gravatar image mjcarroll  ( 2012-07-03 01:11: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

Stats

Asked: 2012-07-01 23:46:47 -0500

Seen: 194 times

Last updated: Jul 11 '12