catkin specific
Introduction
When using catkin, I like to separate the collection of ROS packages which I use across several projects from various project-specific workspaces. To facilitate this, I use two levels of catkin workspace chaining to have an isolated underlay for cmake-based packages and an unisolated or normal underlay for catkin-based packages. Then each of my project workspaces can contain only project-specific code and I don't have to keep updating the same source checkouts again and again.
Setting up isolated and unisolated underlays
First, create the directories for the underlay workspaces:
mkdir -p ~/ws/underlay_isolated/src
mkdir -p ~/ws/underlay/src
Then, chain the workspaces. First create an isolated "install" workspace. This workspace will be used for external projects which support isolated catkin building (like gazebo and orocos).
Initialize the isolated workspace from the system install:
cd ~/ws/underlay_isolated
source /opt/ros/$ROS_DISTRO/setup.bash
catkin_make_isolated --install
Then initialize the unisolated workspace from the isolated one:
source ~/ws/underlay_isolated/install_isolated/setup.sh
cd ~/ws/underlay
catkin_make
Add this to your .bashrc to easily source the chained underlay workspace before starting a new project:
alias source_underlay='source ~/ws/underlay/devel/setup.bash'
When creating a new project, all you need to do is call source_underlay and then continue with the normal catkin workspace creation pattern.
ROS/Patterns/Workspaces