| name | ccws |
| description | CCWS (colcon workspace) development environment for colcon-compatible packages. Use when working with ROS packages (contain package.xml), colcon packages (contain colcon.pkg), or pure CMake packages. Provides cross-compilation, testing, linting, documentation generation, and binary package creation. |
CCWS
Overview
CCWS (colcon workspace) is a development environment that integrates colcon workspaces to facilitate cross-compilation, testing, linting, documentation, and binary package generation. It serves as both a CI/CD backbone and a working environment for developers, compatible with ROS packages, pure CMake packages, and other colcon-compatible projects. CCWS is ROS-version agnostic and can be used for both ROS-specific and ROS-agnostic packages.
When to Use This Skill
This skill should be used when:
- Setting up a new colcon-based workspace with integrated build and test capabilities
- Working with ROS packages, pure CMake packages, or other colcon-compatible projects
- Performing cross-compilation for different platforms (Raspberry Pi, ARM64, etc.)
- Running static analysis and linting on colcon-compatible packages using profiles like clang_tidy, scan_build, and static_checks
- Generating documentation for packages using Doxygen
- Creating Debian binary packages from colcon workspaces
- Managing multiple build profiles for different compilation scenarios
- Running tests for colcon-based projects
- Working with execution profiles for runtime environment modification
- Installing and managing dependencies for packages in the workspace
Core Concepts
Build Profiles
Sets of configurations for the build process, including cmake toolchain, colcon configuration, and environment variables. Profiles do not conflict with each other and can be used in parallel.
Common build profiles:
reldebug - Default compiler, cmake build type RelWithDebInfo, selected by default
release - Release build with tests disabled
scan_build - Compile with clang using scan_build and clang-tidy for static checks
clang_tidy - Simplified scan_build without clang and scan_build
thread_sanitizer - Compilation with thread sanitizer
addr_undef_sanitizers - Compilation with address and undefined behavior sanitizers
static_checks - Static checkers and their configuration
doxygen - Documentation generation with doxygen
cross_raspberry_pi - Cross-compilation for Raspberry Pi
cross_arm64 - Cross-compilation for ARM64
clangd - Generates clangd configuration file
deb - Debian package generation
Execution Profiles
Simple shell mixins that modify the runtime environment, such as executing nodes in valgrind or altering node crash handling.
Common execution profiles:
common - Common parameters for colcon-compatible packages (automatically included)
test - Sets nodes to required mode for testing
valgrind - Sets CCWS_NODE_LAUNCH_PREFIX to valgrind
core_pattern - Sets core pattern to save core files in artifacts
address_sanitizer - Helper for addr_undef_sanitizers profile
Common Workflows
1. Installing Workspace Dependencies
Installing system dependencies for packages in the workspace:
make dep_install
make dep_install PKG=package_name
make rosdep PKG=package_name
Advanced dependency management:
make dep_install PKG=package_name CCWS_DEP_TYPE=all
make dep_install PKG=package_name CCWS_DEP_TYPE=build
make dep_install PKG=package_name CCWS_DEP_TYPE=run
make dep_install PKG=package_name CCWS_DEP_TYPE=test
For cross-compilation scenarios:
make cross_install PKG=my_package BUILD_PROFILE=cross_raspberry_pi [ROS_DISTRO=melodic]
make cross_deps PKG=my_package BUILD_PROFILE=cross_raspberry_pi [ROS_DISTRO=melodic]
Managing dependencies from external sources:
make dep_to_repolist PKG=package_name [ROS_DISTRO=distro_name]
make dep_to_repolist [ROS_DISTRO=distro_name]
Dependency resolution and management:
sudo rosdep update
make private_dep_resolve PKG=package_name
make private_dep_list PKG=package_name
2. Package Compilation
Building specific packages:
make build PKG="package1 package2"
make pkg_name
make build PKG="package1" BUILD_PROFILE=release
make build PKG="package1" JOBS=2
3. Testing
Running tests:
make test PKG=package1
make wstest
make ctest PKG=package1
make wsctest
4. Cross-Compilation
Cross-compiling for different platforms:
make bp_install_build BUILD_PROFILE=cross_raspberry_pi
make cross_install PKG=my_package BUILD_PROFILE=cross_raspberry_pi [ROS_DISTRO=melodic]
make cross_mount BUILD_PROFILE=cross_raspberry_pi
make my_package BUILD_PROFILE=cross_raspberry_pi
make PKG=my_package BUILD_PROFILE=deb,cross_raspberry_pi
make cross_umount BUILD_PROFILE=cross_raspberry_pi
5. Documentation Generation
Generating documentation:
make BUILD_PROFILE=doxygen
firefox artifacts/doxygen/index.html
6. Debian Package Generation
Creating binary packages:
make my_package BUILD_PROFILE=deb,reldebug
ls artifacts/packages/
7. Using Execution Profiles
Running with execution profiles:
source setup.bash reldebug valgrind
make test PKG=my_package EXEC_PROFILE="valgrind core_pattern"
8. Static Analysis and Code Quality Checks
Using static analysis build profiles:
make build PKG=my_package BUILD_PROFILE=clang_tidy
make build PKG=my_package BUILD_PROFILE=scan_build
make build PKG=my_package BUILD_PROFILE=static_checks
Configuration
Custom Configuration
Override developer and vendor specific parameters by adding them to make/config.mk:
BUILD_PROFILE ?= reldebug
JOBS ?= $(shell nproc)
Best Practices
1. Profile Management
- Use different build profiles for different purposes (debug, release, static analysis)
- Combine profiles when needed (e.g.,
deb,reldebug for package generation, clangd,scan_build for IDE support with static analysis)
- Keep profiles isolated to avoid conflicts
2. Dependency Management
- Install build profile dependencies using
make bp_install_build BUILD_PROFILE=<profile>
- Install system dependencies for all packages using
make dep_install.
- Install package-specific dependencies using
make dep_install PKG=<package_name>
- For cross-compilation, ensure system dependencies are installed in the sysroot
- Use
make dep_to_repolist to add dependencies to the workspace for colcon-compatible packages (for ROS packages: make dep_to_repolist PKG=<pkg> ROS_DISTRO=<distro>)
- Use dependency type filters (build, run, test) to install specific types of dependencies:
make dep_install PKG=<pkg> CCWS_DEP_TYPE=<type>
3. Package Organization
- Organize colcon-compatible packages in the
src subdirectory
- Use
make new PKG=<pkg_name> to create new colcon-compatible packages from template
- Maintain clean separation between source, build, and install directories
4. Testing Strategy
- Use the
test execution profile for automated testing of colcon-compatible packages
- Combine multiple execution profiles when needed
- Run tests regularly during development
5. Documentation
- Generate documentation regularly using the doxygen profile
- Keep colcon-compatible package documentation up to date
- Use the generated documentation for reference
Troubleshooting
- If a build fails, consider two potential root causes: incorrect use of the framework or issues in the source space packages. ccws framework correctly handles execution of colcon and sourcing of necessary shell setup scripts.
Additional Resources
- CCWS README: Located at
/ccws/README.md
- Package template: Demonstrates usage of CCWS features for colcon-compatible packages
- Cross-compilation guide:
ccws/doc/cross-compilation.md