com_github_mvukov_rules_ros2 0.0.0-20260118-78d85ffLatest published 5.5mo ago
MODULE.bazel
bazel_dep(name = "com_github_mvukov_rules_ros2", version = "0.0.0-20260118-78d85ff")
README

CI

Bazel rules for ROS 2

This repo provides functionality to build and use ROS 2 with Bazel.

Prerequisites

You will need to install Bazel, see here. Besides Bazel, you will need a C++ compiler and a Python 3 interpreter.

And no, you don't have to install any ROS 2 packages via apt.

The code is developed and tested on Ubuntu 22.04 with Python 3.10.

What works?

Available features:

  • Building of C++, Python and Rust nodes.
  • C/C++/Python/Rust code generation for interfaces (messages, services and actions).
  • Defining ROS 2 deployments with ros2_launch Bazel macro.
  • Defining ROS 2 tests with ros2_test Bazel macro.
  • Defining ROS 2 plugins with ros2_plugin Bazel macro.
  • Only CycloneDDS middleware can be used at the moment.
    • Zero copy transport via shared memory backend (iceoryx) for CycloneDDS.
  • Logging backends:
    • spdlog (default): --@com_github_mvukov_rules_ros2//ros2:rcl_logging_impl=spdlog
    • syslog: --@com_github_mvukov_rules_ros2//ros2:rcl_logging_impl=syslog
  • Utilities:
    • foxglove_bridge for visualization and debugging
    • ros2_bag for handling rosbags
    • ros2_lifecycle for handling node lifecycle
    • ros2_node for handling nodes
    • ros2_param for handling parameters
    • ros2_service for handling services
    • ros2_topic for handling topics
    • xacro for Xacro to URDF conversion

Please take a look at the examples folder to get started.

ROS 2 packages are by default locked to versions from release-humble-20250721.

Notes

[!NOTE] Unlike ROS genmsg which refuses to generate code if the deps between interface targets are not set correctly, code generation for ROS 2 seems to not care about this. If the deps are not correctly set, you'll only see failures during compilation of the generated code.

Alternatives

For alternative approaches, see:

About

Build ROS 2 with Bazel

@mvukov/rules_ros2@mvukov
Homepage
146stars
Thursday, February 5, 2026
@mering#7434 Upload rules_ros2 from curren...

Languages

Python16%
C++13.7%
Smarty1.5%
Dockerfile1.2%
Go Template0.8%
Rust0.7%
Shell0.6%

Maintainers

@mering

Versions

0.0.0-20260118-... +7.9mo2026-02-05
0.0.0-20250612-...100% 22025-06-13