# compulsorily sourcing multiple setup files in same shell.

Hello,

I have 2 catkin workspaces cata_ws , catb_ws

in cata_ws I have a.launch of nodea which when evoked would call b.launch which is in package nodeb in catb_ws.

my problem is if I do a rospack find ( in .launch I would do find) of nodeb , I get resource not found error.

The error is understandable because I have overwritten workspaces and currently cata_ws setup configuration is at the top.

So how do I successfully encode find of nodeb. I am working on a large project hence I need to compulsorily have separate workspaces.

Things I have tried and did not work.

1. set args=nodeb and value=pathtonodeb in a.launch . The problem is that in b.launch there are many includes to launches of other nodes in catb_ws
2. tried source [in cata_ws] devel/setup.sh --extends pathtocatb_ws/devel/setup.sh . Nope did not work

Thanks for the response.

edit retag close merge delete

Sort by » oldest newest most voted

Extending (or overlaying) a particular workspace is something that is most robustly done at build time, not afterwards.

The easiest way to get this working (assuming cata_ws overlays catb_ws) is to:

1. remove build and devel of both workspaces
2. start a new terminal and make sure to have only sourced whatever space catb_ws requires (ie: only the default Indigo setup.bash fi)
3. build catb_ws normally
4. source catb_ws/devel/setup.bash
5. now build cata_ws normally

If this is successful, you should now be able to (in a clean terminal fi) source cata_ws/devel/setup.bash and have rospack find pkg_in_catb_ws work.

This is with catkin_make. For catkin_tools, you may use the --extend option to config to make the overlaying more explicit (see catkin config – Configure a Workspace - Explicitly Specifying Workspace Chaining).

See also Overlaying with catkin workspaces and Overlaying multiple catkin devel-spaces at the same time. That last Q&A is slightly dated, but lists some nice-to-know gotchas.

more

I'd add a step 6: source cata_ws/devel/setup.bash. Now both cata_ws and catb_ws will be "active" with cata_ws overlayed on catb_ws. The rospack command should be able to find packages in either workspace after only sourcing the cata_ws setup.bash file.

( 2015-12-10 06:41:17 -0500 )edit

I had a small typo in my answer: the last source cat.. should've been cata_ws, not catb_ws. That was basically step 6, but not in the list.

Thanks.

( 2015-12-10 06:58:30 -0500 )edit