Which scheduling algorithm is used in ROS?

asked 2020-05-07 13:57:39 -0500

Jessy gravatar image

I'm new to ROS nd I didn't find any information about. Please answer.well thanks in advance

edit retag flag offensive close merge delete

Comments

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)

MCornelis gravatar image MCornelis  ( 2020-05-20 03:10:36 -0500 )edit

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.

MCornelis gravatar image MCornelis  ( 2020-05-20 03:14:04 -0500 )edit

TL;DR the order in which callbacks are executed can be weird.

perhaps a better word would be unexpected.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-20 03:19:19 -0500 )edit

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.

MCornelis gravatar image MCornelis  ( 2020-05-20 03:21:43 -0500 )edit