Skip to content

use_colcon

Ludovic Righetti edited this page Dec 11, 2020 · 15 revisions

Colcon

Description

See in this wiki and in the official documentation

Installation

With pip (installed in /usr/local with sudo is used).

pip install -U colcon-common-extensions pytest setuptools

How to?

In order to build you workspace using colcon you need to go to your workspace root and perform:

colcon build

To build in release mode use

colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

To build a single package use

colcon build --packages-select <package name>

See colcon build -h for more information.

To build and run the unit-tests:

colcon test 

with verbose output:

colcon test --event-handlers console_direct+

for selected package(s):

colcon test --packages-select package_name --event-handlers console_direct+

Visualize the dependency of your workspace

colcon graph --dot --legend | dot -Tpdf -o /tmp/dependencies_graph.pdf
firefox /tmp/dependencies_graph.pdf

colcon-cd and colcon-argcomplete

In order to activate the colcon-cd and colcon completion functionalities you need to add these lines in you bashrc:

  • debian install
# colcon
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash
source /usr/share/colcon_cd/function/colcon_cd.sh
  • pip install
# colcon
source /usr/local/share/colcon_argcomplete/hook/colcon-argcomplete.bash
source /usr/local/share/colcon_cd/function/colcon_cd.sh

Troubleshooting

What if colcon seems to find the wrong python version and install pure python packages with the wrong version in site-packages?

(happened on MacOS): with pip3 install colcon-core a hard copy of colcon is put in /usr/local/bin which is not updated in case you update your python version. Delete this file, remove colcon and install it again. Check that the python script in /usr/local/bin/colcon calls the right version of python

Clone this wiki locally