Which scheduling algorithm is used in ROS?
I'm new to ROS nd I didn't find any information about. Please answer.well thanks in advance
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
I'm new to ROS nd I didn't find any information about. Please answer.well thanks in advance
Asked: 2020-05-07 13:36:59 -0500
Seen: 167 times
Last updated: May 07 '20
To get an idea of how the ROS2 executor handles callbacks you can have a look at the readme here https://github.com/nobleo/rclcpp-stat... , the flowchart is not amazing (my apologies), but it gives you an idea of how the original executor works. The Foxy release comes with a better executor, but still has the weird pre-determined order of timers > subscriptions > services > clients > waitables. And since the wait-set is constructed with rcl handles, I expect that the first subscription that gets created will have priority over the second subscription that gets created in the case they are both ready to execute in the same spin.
TL;DR the order in which callbacks are executed can be weird.
The RealTime working group on ROS discourse is looking into scheduling algorithms and improving this. Some efforts were made by Bosch (micro-ros) to create a LET (logical execution ...(more)
The focus for Foxy was to optimize ROS2 and lower CPU overhead. I think the determinism of the Executor is on the roadmap, but I don't know when this will be available.
The default executor should be good enough in 95% of cases. If you really want to do hard RealTime or you want to have full control over the order of your callbacks then I suggest you write a custom executor in C or C++ using calls to RCL.
perhaps a better word would be unexpected.
Yes, I'm looking for the paper that describes this behaviour in more detail. I can post a link when I find it. It is more clear than the short answer I gave here.
Edit: https://drops.dagstuhl.de/opus/vollte... Chapter 3 is on ROS scheduling. This paper looks at Crystal Clemmys.