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

Revision history [back]

This is where you create multiple workspace overlays (i.e. catkin_wss) and use workspace chaining.

Depending on wether you use catkin_make or catkin tools, the workflow is a bit different. I'll demonstrate this with catkin_make.

  1. create your first workspace, i.e. where you put your package A, as you normally would:

    $ mkdir ~/catkin_ws_A
    $ cd ~/catkin_ws_A
    $ <PUT PACKAGE A IN HERE>
    $ source /opt/ros/<ROSDISTRO>/setup.bash
    $ catkin_make
    
  2. create another workspace for package

    $ mkdir ~/catkin_ws_B
    $ cd ~/catkin_ws_B
    $ <PUT PACKAGE B IN HERE>
    $ source ~/catkin_ws_A/devel/setup.bash   <----- This is the important difference!
    $ catkin_make
    

Now, you can compile both workspaces independently and B has Access to A (but not the other way around!). Also note that you have to compile first catkin_ws_A and then catkin_ws_B if you change something in package A, thus that it takes effect.

Note that you have to source ~/catkin_ws_B/devel/setup.bash to accomplish this. Just sourcing caktin_ws_A will be your regular one workspace layout.

There are some side-effects regarding build artifacts, thus I'd recommend you read the wiki page linked above (section 4) carefully. But all in all, this works pretty well.

This is where you create multiple workspace overlays (i.e. catkin_wss) and use workspace chaining.

Depending on wether you use catkin_make or catkin tools, the workflow is a bit different. I'll demonstrate this with catkin_make.

  1. create your first workspace, i.e. where you put your package A, as you normally would:

    $ mkdir ~/catkin_ws_A
    $ cd ~/catkin_ws_A
    $ <PUT PACKAGE A IN HERE>
    $ source /opt/ros/<ROSDISTRO>/setup.bash
    $ catkin_make
    
  2. create another workspace for package

    $ mkdir ~/catkin_ws_B
    $ cd ~/catkin_ws_B
    $ <PUT PACKAGE B IN HERE>
    $ source ~/catkin_ws_A/devel/setup.bash   <----- This is the important difference!
    $ catkin_make
    

Now, you can compile both workspaces independently and B has Access to A (but not the other way around!). Also note that you have to compile first catkin_ws_A and then catkin_ws_B if you change something in package A, thus that it takes effect.

Note that you have to source ~/catkin_ws_B/devel/setup.bash to accomplish this. Just sourcing caktin_ws_A will be your regular one workspace layout.

There are some side-effects regarding build artifacts, thus I'd recommend you read the wiki page linked above (section 4) carefully. But all in all, this works pretty well.


EDIT

When you already have two workspaces, make sure to delete any build/devel/install/logs folders in caktin_ws_B, as well as the top-Level CMakeLists.txt. You need to create the chaining from a clean workspace. And don't to forget to source ~/catkin_ws_A/devel/setup.bash before calling catkin_make in caktin_ws_B in the same terminal.