Skip to content

chain_ros_workspace

Naveau edited this page Jan 20, 2021 · 7 revisions

How to chain 2 workspace (catkin or colcon)

Requirements

This tutorial assume you know about colcon and what it is.

What is a workspace?

A workspace folder is defined like so:

workspace
├── build
├── install
├── log
└── src

This way the workspace look for the source in src, build them in build and install the binaries in install. This all pretty trivial. Now in the install folder on will see a setup.bash. This file will define a series of environment variables such as:

  • PATH the location of the executables.
  • LD_LIBRARY_PATH path to the libraries
  • PYTHONPATH path to the python installation
  • CMAKE_PREFIX_PATH path to the CMake files installed by the packages.
This way by running `source install/setup.bash`, one can use the binaries built in the install folder.

## Chaining workspaces

Now let us assume that we want to have several workspaces.
The main reason is the compilation time.

For example we have a workspace A with packages a, b and c and a workspace B with packages d, e and f depending on a, b and c.
If all packages a, b, c, d, e and f where in the same workspace one would have to rebuild more frequently all packages.
If they are in different workspace the compilation is done separately. So once workspace A is done compiling on can work an clean workspace B without having to recompile workspace A.

The method to chain workspaces is the following:
- Build workspace A
- source workspace A: `source workspaceA/install/setup.bash`
- build workspace B.

Once done if one source workspace B, the binaries of workspace A **and** B will be available.
Clone this wiki locally