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

compulsorily sourcing multiple setup files in same shell.

asked 2015-12-09 22:22:20 -0600

creative_cimmons gravatar image

updated 2015-12-09 22:23:06 -0600


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/ --extends pathtocatb_ws/devel/ . Nope did not work

Thanks for the response.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2015-12-10 01:51:00 -0600

gvdhoorn gravatar image

updated 2015-12-10 06:58:50 -0600

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.

edit flag offensive delete link 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.

jarvisschultz gravatar image jarvisschultz  ( 2015-12-10 06:41:17 -0600 )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.


gvdhoorn gravatar image gvdhoorn  ( 2015-12-10 06:58:30 -0600 )edit

Question Tools

1 follower


Asked: 2015-12-09 22:22:20 -0600

Seen: 202 times

Last updated: Dec 10 '15