colcon

I should really understand how colcon works. Not should, HAVE TO.

How are you going to contribute to code at NVIDIA if you don’t even know how colcon works.

Resources

A good exercise for this is building ROS2 from source, and actually seeing what is happening under the hood. Brian Chen did this https://chenbrian.ca/posts/ros2_m1/#8-patch-python_cmake_module on his M1 Mac, so you should learn from him.

Things that are done

  • Initialization: Initializes the build environment.
  • Package Discovery: Identifies and orders packages based on dependencies.
  • Build Execution: Builds each package using its build system.
  • Environment Setup: Sets up the environment for built packages.

Colcon vs. CMake?

CMake only works for C++, whereas Colcon works for other languages like Python and rust.

colcon test

Learned from ashwin at NVIDIA.

colcon test --packages-select PACKAGE_NAME

Then, if there is an error, you can do

colcon test-result --verbose

From WATO monorepo: Running Testscolcon test

  • Runs all tests defined in the CMakeLists.txt for the package including the linter
  • Running the following outputs a detailed summary to the console
colcon test --event-handlers console_cohesion+

Viewing Test Failurescolcon test-result --verbose

  • Generates a detailed summary of failing tests including log statements

Running Tests Until Failurecolcon test --retest-until-fail <N>

  • Runs the test suite either N times or until a failure is detected
  • Useful for identifying flaky tests and debugging race conditions