Skip to content

Repository files navigation

ROS 2 Real-Time Support

Overview

This repository provides experimental real-time extensions for ROS 2.
It extends the ROS 2 Client Libraries with real-time–oriented capabilities, such as configurable thread attributes and scheduling behavior, while abstracting RTOS-specific thread APIs behind a common interface.

Background

The work in this repository is based on the concept proposed in REP-2017.

Originally, real-time–related functionality was planned as an extension to core ROS 2 packages (e.g., rcl, rclcpp). Community discussions, including feedback from the PTC, concluded that such functionality would be difficult to maintain within the core. As a result, these capabilities are provided as a separate package set, allowing independent evolution while keeping the ROS 2 core lightweight.

Features

The repository provides experimental real-time extensions for ROS 2, with a focus on thread configuration, scheduling control, and RTOS portability. Basic usage is written in examples_rclcpp_realtime.

Current Status

  • External YAML-based real-time configuration is supported.
  • Thread attributes can be applied to Executors at runtime.
  • POSIX is used as the initial reference backend.

RCL

  • rcl_realtime based on rcl/rcl
    • Introcudes a dedicated context for real-time configuration.
    • Provides APIs for loading and accessing real-time settings (e.g., thread attributes).
  • rcl_realtime_yaml_param_parser based on rcl/rcl_yaml_param_parser
    • Implements a YAML-based configuration parser for real-time settings.
    • Designed to decouple configuration formats from core logic.
  • rcutils_realtime based on rcutils
    • Introduces common data structures for representing thread attributes (priority, affinity, scheduling policy, etc.).

RCLCPP

  • rclcpp_realtime based on rclcpp/rclcpp (reference implementation)
    • Provides a thread-based Executor capable of applying real-time configuration.
    • Extends execution behavior based on the real-time context added to rcl.
    • Only additional executors SchedParamSingleThreadedExecutor and SchedParamMultiThreadedExecutor capable of reading thread attributes
  • rcpputils_realtime based on rcpputils
    • Implements an abstraction layer over OS-specific thread APIs.
    • Currently supports POSIX-based APIs only.

TODO

  • Improve documentation
    • Add API documentation (Doxygen)
    • Document configuration usage (See README of examples_rclcpp_realtime_executor)
      • Executor-option-based configuration
      • YAML-based configuration
      • rosparam-based configuration
    • Provide sample programs and usage examples
  • Expand test coverage
    • Add additional API tests
    • Verify interoperability between rcl and rclcpp APIs
  • Add git history for copied files and improve traceability

Future Work

  • Revise implementation to extend --ros-args
  • Separate rclcpp compatible test workflow
  • Extend backend support to additional platforms and RTOS environments (e.g., Windows, macOS, QNX, VxWorks, eMCOS POSIX, Zephyr)
  • Replace std::thread, std::mutex, and std::condition_variable with implementations that expose and utilize native_handle
  • Apply and validate real-time configurations for ROS message communication mechanisms
  • Compare implementation details and performance with existing publicly available executors

Change Log

(2026 July) 0.1.0

  • Features
    • Add example package exmaple_rclcpp_realtime
    • Remove unnecessary class rclcpp_realtime::Node
    • Implement scheduling-parameter based executors (SchedParamSingleThreadedExecutor, SchedParamMultiThreadedExecutor)
    • Restructure API (e.g., add context_register)
  • Bug Fixes
    • Handle --ros-args argument removal in rcl_realtime::init()
    • Initialize rcl_realtime_context upon adding new entries
    • Improve compatibility and revise the executor in rclcpp_realtime
    • Migrate git history from original ROS core packages
  • Test
    • Add Python tools for testing and implement BUILD_COMP_TESTING CMake option
    • Add rclcpp_preload_wrapper.h to compatibirity check for rclcpp
  • Documentation
    • Add Doxygen API comments to headers
    • Improve README and package documentation
    • Update "Getting Started" guide in examples

(2026 Mar) prototype

  • Features
    • Migrate implementation of REP-2017 & sched_param examples
    • Implement realtime context, arguments and functions
  • Documentation
    • Add project documentation (README, TODOs, and YAML notes)
    • Add package.xml and other package metadata

Acknowlegement

This work was supported by the New Energy and Industrial Technology Development Organization (NEDO), Japan, under commissioned research project JPNP25016.

About

No description, website, or topics provided.

Resources

Stars

11 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages