-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Referring to the draft paper of the executor design below, I found that we face the same challenge below (particularly b.).
https://docs.google.com/document/d/1O53xOVlk4zwsfNukLaDbSWfT64wnoD9xh2EjWwX43qo/edit
1. What kind of cooperation do we want with the OS?
a. E.g. CPU pinning, memory locking, using the OS scheduling policies
b. How could OS scheduling parameters be assigned to ROS 2 Executor and
enforced by the OS (see note in rclc-executor)?
My team is currently investigating how to pass the scheduling parameters to the ROS 2 Executor. And we have already implemented a prototype to receive and apply a set of scheduling parameters for the threads controlled by the ROS 2 real-time executor. We'd like to share the code with the community as some pull requests, but it might be better to share it here and get some feedback from the members who face the same problem here beforehand.
Our basic idea is as below.
- Implement a new class rclcpp::thread and modify rclcpp to use it.
This class has the same function set as the std::thread but also additional features to control its thread attributions. - Modify the rcl layer to receive a set of scheduling parameters.
The parameters are described in YAML format and passed via command line parameters, environment variables, or files. - the rclcpp reads the parameters from rcl and applies them to each thread in the thread pool. *1
*1. the current implementation uses them only for the Multithread Executor.
I've forked the rcl and rclcpp repositories to our team's account and created pull requests for them so that we will be able to have a discussion about it.
rcl: esol-community/rcl#1
rclcpp: esol-community/rclcpp#1
And, considering the discussion below, my team will add a rclcpp::thread implementation delegating all the functions to the std::thread ASAP so as to be able to be used in the environment where the specific rclcpp::thread is not implemented yet.
ros2/rcutils#406