colcon-ros

0.5.0 · active · verified Fri Apr 17

colcon-ros is an extension for the colcon build tool that adds support for discovering and building ROS packages (both ROS 1 and ROS 2 style, primarily ROS 2). It enables `colcon` to understand `package.xml` files, making it the standard build system for ROS 2. The current version is 0.5.0, and it follows the release cadence of the wider colcon and ROS 2 ecosystem, with updates often tied to new ROS distributions.

Common errors

Warnings

Install

Quickstart

This quickstart demonstrates how to set up a basic ROS 2 workspace and build a package using `colcon build`, which leverages `colcon-ros` to discover and process ROS-specific package information. The resulting setup files must be sourced to make the built packages available in your environment.

# 1. Create a ROS 2 workspace directory
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src

# 2. Clone a sample ROS 2 package (e.g., example_interfaces)
git clone https://github.com/ros2/example_interfaces.git

# 3. Navigate back to the workspace root
cd ~/ros2_ws

# 4. Build the workspace using colcon-ros
# colcon-ros integrates seamlessly with `colcon build` to find ROS packages
colcon build

# 5. Source the workspace setup file to make built packages available
# (This needs to be done in every new terminal session)
source install/setup.bash

# 6. Verify a built package is available (e.g., check for an executable)
# For example_interfaces, there might not be a direct executable, 
# but you can check if it's in the AMENT_PREFIX_PATH
# echo $AMENT_PREFIX_PATH

view raw JSON →