From cfa22b1c6f43c210ec476f2382ac7af3b19633db Mon Sep 17 00:00:00 2001 From: atsushi421 Date: Wed, 3 Jun 2026 17:59:07 +0900 Subject: [PATCH] docs(cie): point README to documentation site Reduce the README to a single link to the published documentation site and remove docs/comparison_with_other_executors.md, whose content is now maintained on that site. The upstream lineage note that previously existed only in the README has been added to the documentation site separately. Signed-off-by: atsushi421 --- README.md | 267 +----------------------- docs/comparison_with_other_executors.md | 101 --------- 2 files changed, 1 insertion(+), 367 deletions(-) delete mode 100644 docs/comparison_with_other_executors.md diff --git a/README.md b/README.md index 0fd4027..66fab4b 100644 --- a/README.md +++ b/README.md @@ -1,268 +1,3 @@ # callback_isolated_executor -The ComponentContainer and Executor that assign a dedicated thread for each callback group. -This repository continues development from [https://github.com/sykwer/callback_isolated_executor](https://github.com/sykwer/callback_isolated_executor), which provides the implementation for [this paper](https://arxiv.org/pdf/2505.06546). - -If you find `CallbackIsolatedExecutor` is useful in your research, please consider citing: -- T. Ishikawa-Aso, A. Yano, T. Azumi, and S. Kato, “Work in Progress: Middleware-Transparent Callback Enforcement in Commoditized Component-Oriented Real-Time Systems,” in Proc. of 31st IEEE Real-Time and Embedded Technology and Applications Symposium (RTAS), 2025, pp. 426–429. - -
-BibTeX - -```bibtex -@inproceedings{ishikawa2025work, - title={Work in Progress: Middleware-Transparent Callback Enforcement in Commoditized Component-Oriented Real-Time Systems}, - author={Ishikawa-Aso, Takahiro and Yano, Atsushi and Azumi, Takuya and Kato, Shinpei}, - booktitle={Proc. of 31st IEEE Real-Time and Embedded Technology and Applications Symposium (RTAS)}, - pages={426--429}, - year={2025}, - organization={IEEE} -} -``` -
- -For a comparison of real-time performance with other ROS 2 executors, see [Comparison of Real-Time Performance with Other ROS 2 Executors](docs/comparison_with_other_executors.md). - -## Supported Environments - -CallbackIsolatedExecutor is currently available in the following environments. -This reflects the current status, and support is expected to expand in the future. - -| Category | Supported Versions / Notes | -| ------------------ | ------------------------------------------ | -| ROS 2 | Humble (only with `rclcpp` client library) | -| Linux Distribution | Ubuntu 22.04 (Jammy Jellyfish) | - -## Build and Install -``` -$ git clone https://github.com/autowarefoundation/callback_isolated_executor.git -$ cd callback_isolated_executor -$ source /opt/ros/humble/setup.bash -$ colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -$ source install/setup.bash -``` - -Set capability for the configurator executable to issue the syscalls like `sched_setscheduler(2)`. -``` -$ sudo setcap cap_sys_nice+ep ./build/cie_thread_configurator/thread_configurator_node -``` - -After elevating the priviridge level, part of dynamic linking functionality gets disabled for the security reason. -To deal with it, add a file with the following content under the `/etc/ld.so.conf.d/` directory. -The file name has to be `*.conf`. - -``` -/opt/ros/humble/lib -/opt/ros/humble/lib/x86_64-linux-gnu -/path/to/callback_isolated_executor/install/cie_config_msgs/lib -``` - -To enable the configuration, type the command below. -``` -$ sudo ldconfig -``` - -
-Why ldconfig changed? - - -When specific permissions are granted to an ELF binary using setcap, for security reasons, environment variables like `LD_PRELOAD` and `LD_LIBRARY_PATH` are ignored. -While setting `RUNPATH` on the binary comes to mind as a solution, `RUNPATH` does not easily handle recursive dynamic linking. -In such cases, modifying `/etc/ld.so.conf.d/` is the only option. -
- -## Kernel Boot Parameter -According to [the Linux Kernel documentation](https://www.kernel.org/doc/Documentation/scheduler/sched-deadline.txt), setting the affinity for `SCHED_DEADLINE` tasks requires the use of cgroup v1 features. -To use cgroup v1, it is necessary to disable cgroup v2 by specifying `systemd.unified_cgroup_hierarchy=0` in the kernel boot parameters. - -To change the kernel boot parameters, edit `/etc/default/grub` and add the parameter to `GRUB_CMDLINE_LINUX_DEFAULT`: -``` -GRUB_CMDLINE_LINUX_DEFAULT="... systemd.unified_cgroup_hierarchy=0 ..." -``` - -To apply these changes, run the following commands. After rebooting, the features of cgroup v1 will be available: -```bash -$ sudo update-grub -$ sudo reboot -``` - -## Usage -### Step1: Rewrite your app -When running a node within `ComponentContainerCallbackIsolated`, you don't need to modify the node's implementation. -However, if starting the node directly from the main function without using ComponentContainer, you need to modify the node's implementation as shown below and rebuild it. -Refer to the source code in the [cie_sample_application](https://github.com/autowarefoundation/callback_isolated_executor/tree/main/cie_sample_application) package to understand how to modify your app. - -#### Option1: Launch without ComponentContainer -If you are launching a node directly from the main function without using a ComponentContainer, change the name of the Executor. -```xml - - - - ... - callback_isolated_executor - ... - -``` -```cmake -... -find_package(callback_isolated_executor REQUIRED) -... -ament_target_dependencies(your_executable ... callback_isolated_executor) -... -``` -```cpp -#include "callback_isolated_executor.hpp" - -int main(int argc, char * argv[]) { - rclcpp::init(argc, argv); - - auto node = std::make_shared(); - auto executor = std::make_shared(); - - executor->add_node(node); - executor->spin(); - - rclcpp::shutdown(); - return 0; -} -``` -#### Option2: Launch with ComponentContainer -If you are launching a node within `ComponentContainerCallbackIsolated`, all you have to do is modify the launch file as below. -```xml - - - - ... - - - -``` - -Or, you can load the node to the existing component container. -```xml - - - - - - -``` - -### Step2: Rebuild your app -If you modify the application's source code, a rebuild is necessary. - -### Step3: Generate yaml template file -Open two terminal windows. -In one, launch a ROS 2 node to create a template for the YAML configuration file (`prerun` node), and in the other, launch the target ROS 2 application. -After launching the `prerun` node, launch your ROS 2 application. - -To launch the `prerun` node, type the command below. -```bash -$ ros2 run cie_thread_configurator prerun_node -``` - -Alternatively, you can use the provided launch file: -```bash -$ ros2 launch cie_thread_configurator thread_configurator.launch.xml prerun:=true -``` - -Then launch your ROS 2 application in another terminal window, after which you can see log messages like shown below in the `prerun` node window. -Each entry corresponds to the callback group ID and its OS thread ID. - -cie_image0 - - -Once all the nodes of the target application are up and the logs in the prerun node window have stopped, press Control+C in the prerun node window. -Then, in the current directory, a template for the YAML configuration file `template.yaml` will be created in the format like below. - -```yaml -hardware_info: - model_name: Intel(R) Xeon(R) Silver 4216 CPU @ 2.10GHz - cpu_family: 5 - model: 85 - threads_per_core: 2 - frequency_boost: enabled - cpu_max_mhz: 2101.0000 - cpu_min_mhz: 800.0000 - -callback_groups: - - id: /sample_node@Subscription(/parameter_events)@Service(/sample_node/get_parameters)@Service(/sample_node/get_parameter_types)@Service(/sample_node/set_parameters)@Service(/sample_node/set_parameters_atomically)@Service(/sample_node/describe_parameters)@Service(/sample_node/list_parameters) - affinity: ~ - policy: SCHED_OTHER - priority: 0 - - - id: /sample_node@Subscription(/topic_in) - affinity: ~ - policy: SCHED_OTHER - priority: 0 - - - id: /sample_node@Timer(1333000000) - affinity: ~ - policy: SCHED_OTHER - priority: 0 - - - id: /sample_node@Timer(3000000000) - affinity: ~ - policy: SCHED_OTHER - priority: 0 -``` - -Once the creation of template.yaml is complete, please also terminate the target ROS 2 application. - -The `template.yaml` file includes captured hardware information from the system (CPU details retrieved via `lscpu`). This information will be used for validation when loading the configuration file to ensure compatibility with the target system. - -### Step4: Edit yaml file for scheduler configuration -Change the file name and edit to configure each callback group. -```bash -$ mv template.yaml your_config.yaml -$ vim your_config.yaml -``` - -For callback groups that do not require configuration, you can either delete the entry entirely or leave it as is because the default values in `template.yaml` are set with default nice values and no affinity settings on the CFS scheduler. -For the detailed specifications of the configuration file, please refer to https://github.com/autowarefoundation/callback_isolated_executor/tree/main/cie_thread_configurator#yaml-configuration-file-format. - -### Step5: Launch your app with scheduler configuration -To launch the target ROS 2 application with the scheduler settings applied from the your_config.yaml you created, first start the configurator node with the following command. - -```bash -$ ros2 run cie_thread_configurator thread_configurator_node --ros-args -p config_file:=your_config.yaml -``` - -Alternatively, you can use the provided launch file: -```bash -$ ros2 launch cie_thread_configurator thread_configurator.launch.xml config_file:=your_config.yaml -``` - -If there is a callback group with the `SCHED_DEADLINE` scheduling policy specified, running the configurator node requires root privileges. -This is because it is not possible to set threads to SCHED_DEADLINE within the permissions that can be granted through capability. -Note that if the target ROS 2 application is operating with a specific ROS_DOMAIN_ID, the configurator node must also be operated with the same ROS_DOMAIN_ID. - -```bash -$ sudo bash -c "export ROS_DOMAIN_ID=[app domain id]; source /path/to/callback_isolated_executor/install/setup.bash; ros2 run cie_thread_configurator thread_configurator_node --ros-args -p config_file:=your_config.yaml" -``` - -Immediately after launching the configurator node, it will validate the hardware configuration. The configurator compares the hardware information stored in the configuration file against the current system's hardware details. If there are any mismatches (such as different CPU family or model), the configurator will report an error like: -``` -[ERROR] Hardware validation failed with the following mismatches: - - CPU family: expected '5', got '6' -``` -This validation ensures that the scheduler configuration is applied only on compatible hardware to prevent potential performance or stability issues. - -After successful validation, the configurator will print the settings and then wait for the target ROS 2 application to start running as follows. - -cie_image1 - -In this state, when you launch the target ROS 2 application, the configurator node will receive callback group information from the application. -The entries in the configurator window show the callback group ID and OS thread ID information received from the ROS 2 application, and all configured policies are applied immediately upon receipt, including `SCHED_DEADLINE` (which uses `SCHED_FLAG_RESET_ON_FORK` so that forked children reset to `SCHED_OTHER`). - -The configurator node keeps running after all configurations have been applied. -This allows it to re-apply configurations automatically when a target application restarts (the OS may reuse thread IDs, so thread ID equality cannot be used to skip reconfiguration). -If your configuration includes `SCHED_DEADLINE` threads with CPU affinity (configured via cgroup), the cgroup directories are cleaned up when the configurator node is terminated. - -## Notes on Adoption - -When replacing `rclcpp::executors::SingleThreadedExecutor` with `CallbackIsolatedExecutor`, a dedicated thread is created for each CallbackGroup, enabling parallel execution. -This may expose concurrency bugs that were previously hidden. Therefore, before adoption, you should carefully investigate whether there are any locations that require mutexes or synchronization. -Note that callbacks within the same `MutuallyExclusiveCallbackGroup` are still executed serially. - -When using real-time scheduling policies, such as `SCHED_FIFO` or `SCHED_DEADLINE`, you must carefully consider the potential for delaying kernel processing and other applications, and configure affinity, priority, and [throttling](https://man7.org/linux/man-pages/man7/sched.7.html) appropriately. +Documentation: diff --git a/docs/comparison_with_other_executors.md b/docs/comparison_with_other_executors.md deleted file mode 100644 index 783a96c..0000000 --- a/docs/comparison_with_other_executors.md +++ /dev/null @@ -1,101 +0,0 @@ -# Comparison of Real-Time Performance with Other ROS 2 Executors - -This document compares the real-time performance of the ROS 2 Default Executor and Executors proposed in academic literature from the following perspectives: - -**Immediate Enqueue of Ready Callbacks** - -In the ROS 2 Default Executor, a callback instance that becomes ready is enqueued only when the queue becomes empty. If the callback is enqueued immediately at the moment it becomes ready, ✔ is marked. - -**Per-Callback Priority Assignment** - -The ROS 2 Default Executor does not provide an API to assign priorities on a per-callback basis. If an Executor provides such an API, or allows users to assign priorities per callback through another mechanism, ✔ is marked. - -**Non-Nested Scheduling** - -In many Executors, the Executor maintains its own scheduling layer (e.g., a ready queue with priority ordering), and the OS independently schedules the threads that run callbacks. This two-level structure is referred to as nested scheduling. -If the Executor's scheduling and the OS scheduling do not form such a nested structure, ✔ is marked. - -**Fully Preemptive** - -If a lower-priority callback can be preempted by any higher-priority callback during execution, ✔ is marked. - -**Support for Reentrant Callbacks** - -If, when a callback becomes ready while it is executing, it can be properly enqueued and executed, ✔ is marked. - -**ROS 2 Mainline** - -If the Executor has been merged into the ROS 2 mainline, or can be used by simply installing a standalone package without requiring changes to rcl or rclcpp, ✔ is marked. - ---- - -## Comparison Table - -| Executor | Immediate Enqueue | Per-Callback Priority | Non-Nested Scheduling | Fully Preemptive | Support for Reentrant Callbacks | ROS 2 Mainline | -| ---------------------------------------------- | :---------------: | :-------------------: | :-------------------: | :--------------: | :-----------------------------: | :------------: | -| SingleThreadedExecutor / MultiThreadedExecutor | | | | | | ✔ | -| EventExecutor | ✔ | | | | ✔ | ✔ | -| PiCAS Single [1] | | ✔ | | | | | -| PiCAS Multi [2] | ✔\*1 | ✔ | | | | | -| Dynamic-Priority-based Executor [3,4] | ✔\*1 | ✔ | | | | | -| Extended EventExecutor [5] | ✔ | ✔ | | | ✔ | | -| RTeX [6] | ✔ | ✔ | | | ✔ | | -| Budget-based Real-Time Executor [7] | ✔\*1 | ✔ | ✔ | ✔ | | | -| Preemptive EDF Executor [8] | ✔\*1 | ✔ | ✔ | ✔ | | | -| Ros-RT [9] | ✔ | ✔ | ✔ | ✔ | ✔ | | -| CallbackIsolatedExecutor [10] | ✔\*1 | ✔ | ✔ | ✔ | ✔ | ✔ | - -\*1: The ready queue is updated each time a thread selects a callback to execute. - ---- - -## References - -1. H. Choi, Y. Xiang and H. Kim, - “PiCAS: New Design of Priority-Driven Chain-Aware Scheduling for ROS2,” - *2021 IEEE 27th Real-Time and Embedded Technology and Applications Symposium (RTAS)*, Nashville, TN, USA, 2021, pp. 251–263. - doi: 10.1109/RTAS52030.2021.00028 - -2. H. Sobhani, H. Choi and H. Kim, - “Timing Analysis and Priority-driven Enhancements of ROS 2 Multi-threaded Executors,” - *2023 IEEE 29th RTAS*, San Antonio, TX, USA, 2023, pp. 106–118. - doi: 10.1109/RTAS58335.2023.00016 - -3. A. Al Arafat et al., - “Response time analysis for dynamic priority scheduling in ROS2,” - *DAC ’22*, ACM, 2022, pp. 301–306. - doi: 10.1145/3489517.3530447 - -4. A. Al Arafat et al., - “Dynamic Priority Scheduling of Multithreaded ROS 2 Executor With Shared Resources,” - *IEEE Transactions on CAD*, vol. 43, no. 11, pp. 3732–3743, Nov. 2024. - doi: 10.1109/TCAD.2024.3445259 - -5. H. Teper et al., - “Reconciling ROS 2 with Classical Real-Time Scheduling of Periodic Tasks,” - *2025 IEEE 31st RTAS*, Irvine, CA, USA, 2025, pp. 177–189. - doi: 10.1109/RTAS65571.2025.00027 - -6. S. Liu et al., - “RTeX: An Efficient and Timing-Predictable Multithreaded Executor for ROS 2,” - *IEEE Transactions on CAD*, vol. 43, no. 9, pp. 2578–2591, Sept. 2024. - doi: 10.1109/TCAD.2024.3380551 - -7. J. Staschulat et al., - “Budget-based real-time Executor for Micro-ROS,” - arXiv:2105.05590, 2021. - -8. K. Wilson et al., - “Physics-Informed Mixed-Criticality Scheduling for F1Tenth Cars with Preemptable ROS 2 Executors,” - *2025 IEEE 31st RTAS*, Irvine, CA, USA, 2025, pp. 215–227. - doi: 10.1109/RTAS65571.2025.00030 - -9. S. Liu et al., - “Ros-RT: Enabling Flexible Scheduling in ROS 2,” - *2025 IEEE Real-Time Systems Symposium (RTSS)*, Dec. 2025, pp. 42–54. - doi: 10.1109/RTSS66672.2025.00013 - -10. T. Ishikawa-Aso et al., - “Middleware-Transparent Callback Enforcement in Commoditized Component-Oriented Real-Time Systems,” - *2025 IEEE 31st RTAS*, Irvine, CA, USA, 2025, pp. 426–429. - doi: 10.1109/RTAS65571.2025.00017