From 91011129df74b0d52d602e8b085f5d1d56f60658 Mon Sep 17 00:00:00 2001 From: atsushi421 Date: Sun, 6 Sep 2026 00:53:40 +0900 Subject: [PATCH 1/4] docs: sync with 1.0.0 release and ROSCon JP 2026 hands-on - Add apt install (Humble/Jazzy) and list Jazzy / Ubuntu 24.04 as supported - Restructure the integration guide into the hands-on's step order and add the optional CallbackGroup separation step - Document CAP_SYS_NICE via systemd AmbientCapabilities as the primary option, keeping setcap + ldconfig as the alternative - Document Reentrant CallbackGroup behavior (reentrant_parallelism threads sharing one ID) and the container/executor parameters - Reflect alphabetically sorted CallbackGroup ID entries in the examples - Add Autoware adoption status to the landing page Signed-off-by: atsushi421 --- docs/index.md | 24 ++++- docs/integration-guide.md | 202 +++++++++++++++++++++++++++---------- docs/tutorial.md | 32 ++++-- docs/yaml-specification.md | 28 ++--- 4 files changed, 210 insertions(+), 76 deletions(-) diff --git a/docs/index.md b/docs/index.md index d36244d..56a95e0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -36,10 +36,18 @@ This package continues the development of [`sykwer/callback_isolated_executor`]( | Category | Supported Versions / Notes | |----------|----------------------------| -| ROS 2 | Humble (only with the `rclcpp` client library) | -| Linux Distribution | Ubuntu 22.04 (Jammy Jellyfish) | +| ROS 2 | Humble, Jazzy (only with the `rclcpp` client library) | +| Linux Distribution | Ubuntu 22.04 (Jammy Jellyfish), Ubuntu 24.04 (Noble Numbat) | -This reflects the current status; support is expected to expand in the future. +## Install + +The packages are released on the ROS 2 build farm: + +```bash +sudo apt install ros-$ROS_DISTRO-callback-isolated-executor +``` + +See the [Integration Guide](integration-guide.md) for building from source and for the remaining steps. ## Pages @@ -49,6 +57,16 @@ This reflects the current status; support is expected to expand in the future. - [Tutorial](tutorial.md) — End-to-end walkthrough with the sample application - [Comparison with Other Executors](comparison-with-other-executors.md) — Real-time properties versus other ROS 2 executors +## Adoption in Autoware + +Most of Autoware's major nodes already run on `CallbackIsolatedExecutor`, and the remaining nodes are +scheduled to follow (see the +[Autoware discussion](https://github.com/orgs/autowarefoundation/discussions/6813) and the +[migration issue](https://github.com/autowarefoundation/autoware_core/issues/968)). In TIER IV's +robotaxi, applying `CallbackIsolatedExecutor` with tuned scheduling attributes to the five bottleneck +DAGs (top LiDAR, localization, perception, planning, and control) improved the measured worst-case +response time by roughly 5x compared with default CFS scheduling. + ## Relation to Agnocast [Agnocast](https://github.com/autowarefoundation/agnocast) provides an Agnocast-compatible port of this diff --git a/docs/integration-guide.md b/docs/integration-guide.md index cf984b8..27b861d 100644 --- a/docs/integration-guide.md +++ b/docs/integration-guide.md @@ -2,21 +2,69 @@ ## Overview -1. **Build and install** the `callback_isolated_executor` packages +0. **(Optional) Separate CallbackGroups** so that every callback you want to schedule strictly gets its own thread +1. **Install** the `callback_isolated_executor` packages 2. **Switch the executor** in your application code or launch file -3. **Set up the thread configurator** (one-time system configuration) -4. **Generate a YAML template** by running the configurator in prerun mode -5. **Edit the YAML** to assign scheduling policies, priorities, and CPU affinities +3. **Generate a YAML template** by running the configurator in prerun mode +4. **Edit the YAML** to assign scheduling policies, priorities, and CPU affinities +5. **Grant `CAP_SYS_NICE`** to the thread configurator (one-time system configuration) 6. **Launch the configurator** with your config file, then start your application See the [Tutorial](tutorial.md) for a concrete walkthrough with the sample application. -## Step 1: Build and Install +## Step 0 (Optional): Separate CallbackGroups + +`CallbackIsolatedExecutor` assigns one OS thread per CallbackGroup, so the CallbackGroup is the unit of +scheduling: callbacks in the same group share a thread and therefore share scheduling parameters. Give +every callback whose scheduling you want to control strictly its own CallbackGroup: + +```cpp +timer_group_ = create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive); +timer_ = create_wall_timer(100ms, std::bind(&MyNode::on_timer, this), timer_group_); + +sub_group_ = create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive); +rclcpp::SubscriptionOptions sub_options; +sub_options.callback_group = sub_group_; +subscription_ = create_subscription("topic", 10, callback, sub_options); +``` + +If callbacks were placed in one `MutuallyExclusive` group only to serialize access to shared state, +move them into separate groups and protect the shared state with a mutex instead (see +[Concurrency](#notes-on-adoption)). + +### Reentrant CallbackGroups + +A `Reentrant` CallbackGroup is served by `reentrant_parallelism` threads (default `4`) instead of one. +All of them report the same CallbackGroup ID, so a single `callback_groups` entry configures every +thread of the group. `reentrant_parallelism` is a constructor argument of `CallbackIsolatedExecutor` +and a node parameter of the component container (see Step 2); a value below `2` gives the group a +single thread, like a `MutuallyExclusive` group. + +!!! note + In prerun mode, the extra threads of a `Reentrant` group are reported as + `Duplicate callback_group_id received`. This is harmless: the template still contains exactly one + entry for the group. + +## Step 1: Install + +### Option A: apt + +`callback_isolated_executor` is released on the ROS 2 build farm for Humble and Jazzy: + +```bash +sudo apt install ros-$ROS_DISTRO-callback-isolated-executor +# Optional: the sample application used in the Tutorial +sudo apt install ros-$ROS_DISTRO-cie-sample-application +``` + +If `apt` cannot find the package for your distribution yet, build from source. + +### Option B: Build from source ```bash git clone https://github.com/autowarefoundation/callback_isolated_executor.git cd callback_isolated_executor -source /opt/ros/humble/setup.bash +source /opt/ros/$ROS_DISTRO/setup.bash colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release source install/setup.bash ``` @@ -69,6 +117,10 @@ int main(int argc, char * argv[]) { } ``` +The constructor takes optional arguments `(rclcpp::ExecutorOptions, size_t reentrant_parallelism, +bool yield_before_execute, std::chrono::nanoseconds next_exec_timeout)`; they only affect +`Reentrant` CallbackGroups (see [Step 0](#reentrant-callbackgroups)). + ### Option 2: Launch with a ComponentContainer Use `component_container_callback_isolated` from the `callback_isolated_executor` package as the @@ -96,21 +148,97 @@ Alternatively, load a node into an existing container: ``` +The container accepts the node parameters `reentrant_parallelism` (default `4`), `yield_before_execute` +(default `false`), and `next_exec_timeout_ns` (default `-1`), which apply to the threads serving +`Reentrant` CallbackGroups. + If you modify application source code (Option 1), rebuild before continuing. -## Step 3: Set Up the Thread Configurator +## Step 3: Generate a YAML Template + +Open two terminals. In the first, start the `prerun` node **before** launching your application; in the +second, launch your application. The prerun node does not need any special privileges. + +```bash +# Terminal 1: start the prerun node first +ros2 run cie_thread_configurator prerun_node +# or: ros2 launch cie_thread_configurator thread_configurator.launch.xml prerun:=true + +# Terminal 2: then launch your application +ros2 launch your_package your_launch.xml +``` + +As the application starts, the prerun node logs one entry per CallbackGroup, each showing the +CallbackGroup ID and its OS thread ID. Once all nodes are up and the log output settles, press +`Ctrl+C` in the prerun terminal. A `template.yaml` is created in the current directory, then stop the +target application. + +The template captures hardware information from the system (CPU details via `lscpu`) under +`hardware_info`. This is used to validate compatibility when the configuration is later loaded. See the +[YAML Specification](yaml-specification.md) for the full format. + +## Step 4: Edit the YAML + +Rename and edit the template to configure each CallbackGroup: + +```bash +mv template.yaml your_config.yaml +``` + +For CallbackGroups that do not require configuration, either delete the entry or leave it unchanged — +the defaults in `template.yaml` use the standard CFS scheduler with the default nice value and no +affinity. See the [YAML Specification](yaml-specification.md) for every available option. + +## Step 5: Grant CAP_SYS_NICE to the Thread Configurator + +The `cie_thread_configurator` applies the scheduling parameters from your YAML file to the threads of +other processes through `sched_setscheduler(2)`, `sched_setattr(2)`, `setpriority(2)`, and +`sched_setaffinity(2)`. These calls require the `CAP_SYS_NICE` capability. There are two ways to grant +it. + +### Option 1: systemd service with AmbientCapabilities (easiest) + +Ambient capabilities are inherited across `execve`, so `ros2 run` and the node binary receive +`CAP_SYS_NICE` without modifying the binary and without the dynamic-linker restrictions described in +Option 2. + +Create `/etc/systemd/system/thread_configurator.service`: + +```ini +[Unit] +Description=CIE thread configurator + +[Service] +User= +AmbientCapabilities=CAP_SYS_NICE +# Match the target application's environment, e.g.: +# Environment=ROS_DOMAIN_ID=0 +ExecStart=/bin/bash -c 'source /opt/ros/humble/setup.bash && exec ros2 run cie_thread_configurator thread_configurator_node --ros-args -p config_file:=/absolute/path/to/your_config.yaml' + +[Install] +WantedBy=multi-user.target +``` + +For a source build, source your workspace's `install/setup.bash` instead of `/opt/ros/humble/setup.bash`. +Then load and start the service: -The `cie_thread_configurator` applies the scheduling parameters from your YAML file to each -CallbackGroup's thread. It needs the `CAP_SYS_NICE` capability to issue syscalls such as -`sched_setscheduler(2)`. +```bash +sudo systemctl daemon-reload +sudo systemctl start thread_configurator # or: sudo systemctl enable --now thread_configurator +journalctl -u thread_configurator -f # follow the configurator's log +``` -### Grant capabilities +### Option 2: setcap on the binary ```bash -sudo setcap cap_sys_nice+ep ./build/cie_thread_configurator/thread_configurator_node +sudo setcap cap_sys_nice+ep \ + $(ros2 pkg prefix cie_thread_configurator)/lib/cie_thread_configurator/thread_configurator_node ``` -### Configure library paths +File capabilities are attached to the binary itself, so re-run this after every rebuild or package +upgrade. + +#### Configure library paths After `setcap`, the dynamic linker ignores `LD_PRELOAD` and `LD_LIBRARY_PATH` for security reasons. Register the required library directories explicitly by creating a file under `/etc/ld.so.conf.d/` whose @@ -119,9 +247,11 @@ name ends in `.conf` — for example `/etc/ld.so.conf.d/callback-isolated-execut ```text /opt/ros/humble/lib /opt/ros/humble/lib/x86_64-linux-gnu -/path/to/callback_isolated_executor/install/cie_config_msgs/lib ``` +For a source build, also add the `lib` directory of `cie_config_msgs` in your install space, for example +`/path/to/callback_isolated_executor/install/cie_config_msgs/lib`. + Apply the change: ```bash @@ -153,44 +283,11 @@ sudo update-grub sudo reboot ``` -## Step 4: Generate a YAML Template - -Open two terminals. In the first, start the `prerun` node **before** launching your application; in the -second, launch your application. - -```bash -# Terminal 1: start the prerun node first -ros2 run cie_thread_configurator prerun_node -# or: ros2 launch cie_thread_configurator thread_configurator.launch.xml prerun:=true - -# Terminal 2: then launch your application -ros2 launch your_package your_launch.xml -``` - -As the application starts, the prerun node logs one entry per CallbackGroup, each showing the -CallbackGroup ID and its OS thread ID. Once all nodes are up and the log output settles, press -`Ctrl+C` in the prerun terminal. A `template.yaml` is created in the current directory, then stop the -target application. - -The template captures hardware information from the system (CPU details via `lscpu`) under -`hardware_info`. This is used to validate compatibility when the configuration is later loaded. See the -[YAML Specification](yaml-specification.md) for the full format. - -## Step 5: Edit the YAML - -Rename and edit the template to configure each CallbackGroup: - -```bash -mv template.yaml your_config.yaml -``` - -For CallbackGroups that do not require configuration, either delete the entry or leave it unchanged — -the defaults in `template.yaml` use the standard CFS scheduler with the default nice value and no -affinity. See the [YAML Specification](yaml-specification.md) for every available option. - ## Step 6: Launch with the Scheduler Configuration -Start the configurator node with your config file **before** launching the target application: +Start the configurator node with your config file **before** launching the target application. If you +created the systemd service in Step 5, `systemctl start thread_configurator` already does this; +otherwise run: ```bash ros2 run cie_thread_configurator thread_configurator_node --ros-args -p config_file:=your_config.yaml @@ -218,8 +315,9 @@ configurator node is terminated. !!! note "SCHED_DEADLINE requires root" A thread cannot be set to `SCHED_DEADLINE` with capabilities alone, so if any CallbackGroup uses - `SCHED_DEADLINE`, the configurator must run as **root**. If the target application runs under a - specific `ROS_DOMAIN_ID`, the configurator must use the same domain ID: + `SCHED_DEADLINE`, the configurator must run as **root** (with the systemd service, omit `User=`). + If the target application runs under a specific `ROS_DOMAIN_ID`, the configurator must use the same + domain ID: ```bash sudo bash -c "export ROS_DOMAIN_ID=[app domain id]; \ diff --git a/docs/tutorial.md b/docs/tutorial.md index fc800b6..241acd9 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -4,9 +4,17 @@ This tutorial walks through the full workflow with the `cie_sample_application` application under `CallbackIsolatedExecutor`, generate a thread configuration template, apply scheduling parameters, and verify the result. -It assumes you have already completed [Build and Install](integration-guide.md#step-1-build-and-install) -and the [thread configurator setup](integration-guide.md#step-3-set-up-the-thread-configurator) (granting -capabilities and configuring library paths). +It assumes you have already [installed the packages](integration-guide.md#step-1-install) and +[granted `CAP_SYS_NICE`](integration-guide.md#step-5-grant-cap_sys_nice-to-the-thread-configurator) to +the thread configurator. The sample application is available from apt: + +```bash +sudo apt install ros-$ROS_DISTRO-cie-sample-application +``` + +The configurator is run interactively in a terminal below, which corresponds to the `setcap` option. If +you set it up as a systemd service instead, start the service in place of the Terminal 1 command in +Step 4. ## Sample Application @@ -20,6 +28,12 @@ capabilities and configuring library paths). It also spawns a non-ROS worker thread named `sample_non_ros_thread` via `spawn_non_ros2_thread` (see [Non-ROS Threads](non-ros-threads.md)). +!!! tip "Reentrant CallbackGroups" + `ros2 run cie_sample_application reentrant_node_main` runs `ReentrantNode`, whose single + `Reentrant` CallbackGroup (two timers, 100 ms and 1000 ms) is served by four threads. All four report + the same CallbackGroup ID, so one `callback_groups` entry configures them all (see + [Reentrant CallbackGroups](integration-guide.md#reentrant-callbackgroups)). + ## Step 1: Launch the Application ```bash @@ -49,17 +63,17 @@ abbreviated here): ```yaml hardware_info: - model_name: Intel(R) Xeon(R) Silver 4216 CPU @ 2.10GHz cpu_family: 6 - model: 85 - threads_per_core: 1 - frequency_boost: enabled cpu_max_mhz: 2101.0000 cpu_min_mhz: 800.0000 + frequency_boost: enabled + model: 85 + model_name: Intel(R) Xeon(R) Silver 4216 CPU @ 2.10GHz + threads_per_core: 1 callback_groups: - # default group: /parameter_events + parameter services (full id generated by prerun) - - id: /sample_space/sample_subspace/sample_node@Subscription(/parameter_events)@Service(...) + # default group: parameter services + /parameter_events (full id generated by prerun) + - id: /sample_space/sample_subspace/sample_node@Service(.../describe_parameters)@Service(...)@Subscription(/parameter_events) affinity: ~ policy: SCHED_OTHER nice: 0 diff --git a/docs/yaml-specification.md b/docs/yaml-specification.md index 5f64f4d..9aca4d6 100644 --- a/docs/yaml-specification.md +++ b/docs/yaml-specification.md @@ -44,6 +44,10 @@ Which scheduling-parameter key is required depends on the policy: CFS policies ( rejected at startup with an error naming the key; a stray key of another policy class is ignored like any other unknown key. +A `Reentrant` CallbackGroup is served by several threads (see +[Reentrant CallbackGroups](integration-guide.md#reentrant-callbackgroups)). They all report the same +ID, so one entry configures every thread of the group. + ### affinity `affinity` is an array of core numbers allowed to run the thread, corresponding to the CPU set used @@ -138,10 +142,17 @@ callback contained in the CallbackGroup. There are four callback types: - `Client()` - `Timer()` -For example: +Entries are sorted alphabetically, so an ID does not depend on the order in which the callbacks were +created. For example, the default CallbackGroup of `/sample_node` (parameter services plus the +`/parameter_events` subscription) and two user-defined groups look like this: ```yaml callback_groups: + - id: /sample_node@Service(/sample_node/describe_parameters)@Service(/sample_node/get_parameter_types)@Service(/sample_node/get_parameters)@Service(/sample_node/list_parameters)@Service(/sample_node/set_parameters)@Service(/sample_node/set_parameters_atomically)@Subscription(/parameter_events) + affinity: ~ + policy: SCHED_OTHER + nice: 0 + - id: /sample_node@Subscription(/topic_in) affinity: ~ policy: SCHED_OTHER @@ -163,17 +174,10 @@ callback_groups: ## non_ros_threads -Threads that are not part of any ROS 2 executor can also be configured. The fields match -`callback_groups` except that `id` is the thread name (see [Non-ROS Threads](non-ros-threads.md) for -how to create such threads): - -| Field | Required | Description | -|-------|----------|-------------| -| `id` | Yes | Thread name (must match the name passed to `spawn_non_ros2_thread`) | -| `policy` | Yes | Scheduling policy (same options as `callback_groups`) | -| `nice` | CFS policies only | Nice value, `-20` … `19` | -| `priority` | `SCHED_FIFO` / `SCHED_RR` only | Real-time priority, `1` … `99` | -| `affinity` | No | List of CPU cores | +Threads that are not part of any ROS 2 executor can also be configured. The fields are identical to +[`callback_groups`](#callback_groups), including the `SCHED_DEADLINE` parameters, except that `id` is +the thread name passed to `spawn_non_ros2_thread` (see [Non-ROS Threads](non-ros-threads.md) for how +to create such threads): ```yaml non_ros_threads: From 5aa75fd14b94db485f9c9965394f4eb8350a782e Mon Sep 17 00:00:00 2001 From: atsushi421 Date: Sun, 6 Sep 2026 00:56:26 +0900 Subject: [PATCH 2/4] docs: drop Autoware adoption section from landing page Signed-off-by: atsushi421 --- docs/index.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/docs/index.md b/docs/index.md index 56a95e0..e14ca12 100644 --- a/docs/index.md +++ b/docs/index.md @@ -57,16 +57,6 @@ See the [Integration Guide](integration-guide.md) for building from source and f - [Tutorial](tutorial.md) — End-to-end walkthrough with the sample application - [Comparison with Other Executors](comparison-with-other-executors.md) — Real-time properties versus other ROS 2 executors -## Adoption in Autoware - -Most of Autoware's major nodes already run on `CallbackIsolatedExecutor`, and the remaining nodes are -scheduled to follow (see the -[Autoware discussion](https://github.com/orgs/autowarefoundation/discussions/6813) and the -[migration issue](https://github.com/autowarefoundation/autoware_core/issues/968)). In TIER IV's -robotaxi, applying `CallbackIsolatedExecutor` with tuned scheduling attributes to the five bottleneck -DAGs (top LiDAR, localization, perception, planning, and control) improved the measured worst-case -response time by roughly 5x compared with default CFS scheduling. - ## Relation to Agnocast [Agnocast](https://github.com/autowarefoundation/agnocast) provides an Agnocast-compatible port of this From ae572c0e98d36983a1b9cbc530cd302df4181cec Mon Sep 17 00:00:00 2001 From: atsushi421 Date: Sun, 6 Sep 2026 00:57:59 +0900 Subject: [PATCH 3/4] docs: drop Reentrant CallbackGroup details Signed-off-by: atsushi421 --- docs/integration-guide.md | 21 --------------------- docs/tutorial.md | 6 ------ docs/yaml-specification.md | 4 ---- 3 files changed, 31 deletions(-) diff --git a/docs/integration-guide.md b/docs/integration-guide.md index 27b861d..02cff02 100644 --- a/docs/integration-guide.md +++ b/docs/integration-guide.md @@ -32,19 +32,6 @@ If callbacks were placed in one `MutuallyExclusive` group only to serialize acce move them into separate groups and protect the shared state with a mutex instead (see [Concurrency](#notes-on-adoption)). -### Reentrant CallbackGroups - -A `Reentrant` CallbackGroup is served by `reentrant_parallelism` threads (default `4`) instead of one. -All of them report the same CallbackGroup ID, so a single `callback_groups` entry configures every -thread of the group. `reentrant_parallelism` is a constructor argument of `CallbackIsolatedExecutor` -and a node parameter of the component container (see Step 2); a value below `2` gives the group a -single thread, like a `MutuallyExclusive` group. - -!!! note - In prerun mode, the extra threads of a `Reentrant` group are reported as - `Duplicate callback_group_id received`. This is harmless: the template still contains exactly one - entry for the group. - ## Step 1: Install ### Option A: apt @@ -117,10 +104,6 @@ int main(int argc, char * argv[]) { } ``` -The constructor takes optional arguments `(rclcpp::ExecutorOptions, size_t reentrant_parallelism, -bool yield_before_execute, std::chrono::nanoseconds next_exec_timeout)`; they only affect -`Reentrant` CallbackGroups (see [Step 0](#reentrant-callbackgroups)). - ### Option 2: Launch with a ComponentContainer Use `component_container_callback_isolated` from the `callback_isolated_executor` package as the @@ -148,10 +131,6 @@ Alternatively, load a node into an existing container: ``` -The container accepts the node parameters `reentrant_parallelism` (default `4`), `yield_before_execute` -(default `false`), and `next_exec_timeout_ns` (default `-1`), which apply to the threads serving -`Reentrant` CallbackGroups. - If you modify application source code (Option 1), rebuild before continuing. ## Step 3: Generate a YAML Template diff --git a/docs/tutorial.md b/docs/tutorial.md index 241acd9..722e9a6 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -28,12 +28,6 @@ Step 4. It also spawns a non-ROS worker thread named `sample_non_ros_thread` via `spawn_non_ros2_thread` (see [Non-ROS Threads](non-ros-threads.md)). -!!! tip "Reentrant CallbackGroups" - `ros2 run cie_sample_application reentrant_node_main` runs `ReentrantNode`, whose single - `Reentrant` CallbackGroup (two timers, 100 ms and 1000 ms) is served by four threads. All four report - the same CallbackGroup ID, so one `callback_groups` entry configures them all (see - [Reentrant CallbackGroups](integration-guide.md#reentrant-callbackgroups)). - ## Step 1: Launch the Application ```bash diff --git a/docs/yaml-specification.md b/docs/yaml-specification.md index 9aca4d6..b299fb1 100644 --- a/docs/yaml-specification.md +++ b/docs/yaml-specification.md @@ -44,10 +44,6 @@ Which scheduling-parameter key is required depends on the policy: CFS policies ( rejected at startup with an error naming the key; a stray key of another policy class is ignored like any other unknown key. -A `Reentrant` CallbackGroup is served by several threads (see -[Reentrant CallbackGroups](integration-guide.md#reentrant-callbackgroups)). They all report the same -ID, so one entry configures every thread of the group. - ### affinity `affinity` is an array of core numbers allowed to run the thread, corresponding to the CPU set used From 2b051111f0ba5e6bbb014455b8d6209b2923e4e0 Mon Sep 17 00:00:00 2001 From: atsushi421 Date: Sun, 6 Sep 2026 01:33:08 +0900 Subject: [PATCH 4/4] fix: address review findings - Overview: use an explicit "Step N" bullet list; the 0-based ordered list rendered as 1..7 - Install: state that Jazzy binaries may not be published yet (guide and landing page) - systemd unit / ld.so.conf.d: replace hardcoded humble and x86_64 with / placeholders - systemd unit: list RMW and discovery environment variables that must match the application - Tutorial: order the template.yaml callback_groups sample as prerun actually emits it - YAML spec: clarify what is sorted in CallbackGroup IDs; sort hardware_info in the full example - Wording: "control its own dedicated CallbackGroup"; split the template.yaml run-on sentence - mkdocs: enable validation.anchors so --strict catches broken fragment links Signed-off-by: atsushi421 --- docs/index.md | 3 ++- docs/integration-guide.md | 43 ++++++++++++++++++++++---------------- docs/tutorial.md | 4 ++-- docs/yaml-specification.md | 13 ++++++------ mkdocs.yaml | 2 ++ 5 files changed, 38 insertions(+), 27 deletions(-) diff --git a/docs/index.md b/docs/index.md index e14ca12..55cae8c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -41,7 +41,8 @@ This package continues the development of [`sykwer/callback_isolated_executor`]( ## Install -The packages are released on the ROS 2 build farm: +The packages are released on the ROS 2 build farm (Humble binaries are available; for Jazzy, build from +source until the binaries are published): ```bash sudo apt install ros-$ROS_DISTRO-callback-isolated-executor diff --git a/docs/integration-guide.md b/docs/integration-guide.md index 02cff02..eaaef82 100644 --- a/docs/integration-guide.md +++ b/docs/integration-guide.md @@ -2,13 +2,13 @@ ## Overview -0. **(Optional) Separate CallbackGroups** so that every callback you want to schedule strictly gets its own thread -1. **Install** the `callback_isolated_executor` packages -2. **Switch the executor** in your application code or launch file -3. **Generate a YAML template** by running the configurator in prerun mode -4. **Edit the YAML** to assign scheduling policies, priorities, and CPU affinities -5. **Grant `CAP_SYS_NICE`** to the thread configurator (one-time system configuration) -6. **Launch the configurator** with your config file, then start your application +- **Step 0 (Optional): Separate CallbackGroups** so that every callback whose scheduling you want to control gets its own thread +- **Step 1: Install** the `callback_isolated_executor` packages +- **Step 2: Switch the executor** in your application code or launch file +- **Step 3: Generate a YAML template** by running the configurator in prerun mode +- **Step 4: Edit the YAML** to assign scheduling policies, priorities, and CPU affinities +- **Step 5: Grant `CAP_SYS_NICE`** to the thread configurator (one-time system configuration) +- **Step 6: Launch the configurator** with your config file, then start your application See the [Tutorial](tutorial.md) for a concrete walkthrough with the sample application. @@ -16,7 +16,7 @@ See the [Tutorial](tutorial.md) for a concrete walkthrough with the sample appli `CallbackIsolatedExecutor` assigns one OS thread per CallbackGroup, so the CallbackGroup is the unit of scheduling: callbacks in the same group share a thread and therefore share scheduling parameters. Give -every callback whose scheduling you want to control strictly its own CallbackGroup: +every callback whose scheduling you want to control its own dedicated CallbackGroup: ```cpp timer_group_ = create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive); @@ -36,7 +36,8 @@ move them into separate groups and protect the shared state with a mutex instead ### Option A: apt -`callback_isolated_executor` is released on the ROS 2 build farm for Humble and Jazzy: +`callback_isolated_executor` is released on the ROS 2 build farm. Binaries are available for Humble; +Jazzy is registered but its binaries may not be on `packages.ros.org` yet: ```bash sudo apt install ros-$ROS_DISTRO-callback-isolated-executor @@ -44,7 +45,7 @@ sudo apt install ros-$ROS_DISTRO-callback-isolated-executor sudo apt install ros-$ROS_DISTRO-cie-sample-application ``` -If `apt` cannot find the package for your distribution yet, build from source. +If `apt` cannot find the package for your distribution, build from source (Option B). ### Option B: Build from source @@ -149,7 +150,7 @@ ros2 launch your_package your_launch.xml As the application starts, the prerun node logs one entry per CallbackGroup, each showing the CallbackGroup ID and its OS thread ID. Once all nodes are up and the log output settles, press -`Ctrl+C` in the prerun terminal. A `template.yaml` is created in the current directory, then stop the +`Ctrl+C` in the prerun terminal. A `template.yaml` is created in the current directory. Then stop the target application. The template captures hardware information from the system (CPU details via `lscpu`) under @@ -190,16 +191,20 @@ Description=CIE thread configurator [Service] User= AmbientCapabilities=CAP_SYS_NICE -# Match the target application's environment, e.g.: +# Match the target application's ROS environment. If these differ, discovery fails silently and the +# configurator never receives any CallbackGroup. # Environment=ROS_DOMAIN_ID=0 -ExecStart=/bin/bash -c 'source /opt/ros/humble/setup.bash && exec ros2 run cie_thread_configurator thread_configurator_node --ros-args -p config_file:=/absolute/path/to/your_config.yaml' +# Environment=RMW_IMPLEMENTATION=rmw_cyclonedds_cpp +# Environment=ROS_LOCALHOST_ONLY=1 # Humble; ROS_AUTOMATIC_DISCOVERY_RANGE on Jazzy +ExecStart=/bin/bash -c 'source /opt/ros//setup.bash && exec ros2 run cie_thread_configurator thread_configurator_node --ros-args -p config_file:=/absolute/path/to/your_config.yaml' [Install] WantedBy=multi-user.target ``` -For a source build, source your workspace's `install/setup.bash` instead of `/opt/ros/humble/setup.bash`. -Then load and start the service: +Replace `` with your ROS 2 distribution (`humble` or `jazzy`); a unit file cannot expand +`$ROS_DISTRO`. For a source build, source your workspace's `install/setup.bash` instead. Then load and +start the service: ```bash sudo systemctl daemon-reload @@ -224,11 +229,13 @@ Register the required library directories explicitly by creating a file under `/ name ends in `.conf` — for example `/etc/ld.so.conf.d/callback-isolated-executor.conf`: ```text -/opt/ros/humble/lib -/opt/ros/humble/lib/x86_64-linux-gnu +/opt/ros//lib +/opt/ros//lib/-linux-gnu ``` -For a source build, also add the `lib` directory of `cie_config_msgs` in your install space, for example +Replace `` with your ROS 2 distribution and `` with your architecture (`x86_64` or +`aarch64`; check with `ls /opt/ros/$ROS_DISTRO/lib | grep linux-gnu`). For a source build, also add the +`lib` directory of `cie_config_msgs` in your install space, for example `/path/to/callback_isolated_executor/install/cie_config_msgs/lib`. Apply the change: diff --git a/docs/tutorial.md b/docs/tutorial.md index 722e9a6..c0b4b7c 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -72,7 +72,7 @@ callback_groups: policy: SCHED_OTHER nice: 0 - - id: /sample_space/sample_subspace/sample_node@Timer(3000000000) + - id: /sample_space/sample_subspace/sample_node@Subscription(/sample_space/sample_subspace/topic_in) affinity: ~ policy: SCHED_OTHER nice: 0 @@ -82,7 +82,7 @@ callback_groups: policy: SCHED_OTHER nice: 0 - - id: /sample_space/sample_subspace/sample_node@Subscription(/sample_space/sample_subspace/topic_in) + - id: /sample_space/sample_subspace/sample_node@Timer(3000000000) affinity: ~ policy: SCHED_OTHER nice: 0 diff --git a/docs/yaml-specification.md b/docs/yaml-specification.md index b299fb1..5290002 100644 --- a/docs/yaml-specification.md +++ b/docs/yaml-specification.md @@ -138,8 +138,9 @@ callback contained in the CallbackGroup. There are four callback types: - `Client()` - `Timer()` -Entries are sorted alphabetically, so an ID does not depend on the order in which the callbacks were -created. For example, the default CallbackGroup of `/sample_node` (parameter services plus the +The callback entries within an ID are sorted alphabetically, so an ID does not depend on the order in +which the callbacks were created; prerun also writes the `callback_groups` list sorted by ID. For +example, the default CallbackGroup of `/sample_node` (parameter services plus the `/parameter_events` subscription) and two user-defined groups look like this: ```yaml @@ -204,13 +205,13 @@ section automatically. ```yaml hardware_info: - model_name: Intel(R) Xeon(R) Silver 4216 CPU @ 2.10GHz cpu_family: 6 - model: 85 - threads_per_core: 1 - frequency_boost: enabled cpu_max_mhz: 2101.0000 cpu_min_mhz: 800.0000 + frequency_boost: enabled + model: 85 + model_name: Intel(R) Xeon(R) Silver 4216 CPU @ 2.10GHz + threads_per_core: 1 callback_groups: - id: /camera_node@Subscription(/camera/image) diff --git a/mkdocs.yaml b/mkdocs.yaml index f8efc74..ef4fcc3 100644 --- a/mkdocs.yaml +++ b/mkdocs.yaml @@ -7,6 +7,8 @@ site_url: https://autowarefoundation.github.io/callback_isolated_executor_doc repo_url: https://github.com/autowarefoundation/callback_isolated_executor repo_name: autowarefoundation/callback_isolated_executor docs_dir: docs +validation: + anchors: warn copyright: Copyright © 2026 The Autoware Foundation theme: