ros2 / examples

Example packages for ROS 2
Apache License 2.0
691 stars 311 forks source link

Improve scheduling configuration of examples_rclcpp_cbg_executor package #331

Closed ralph-lange closed 2 years ago

ralph-lange commented 2 years ago

Chose the configuration of the high prio Executor thread to be below typical threaded interrupt handlers. Explained scheduling configuration in the code.

adityapande-1995 commented 2 years ago

CI :

adityapande-1995 commented 2 years ago

A small question : why are we changing the existing scheduling priority in this example ? Was that causing some problems, or this is just an enhancement ? cc @wjwwood

ralph-lange commented 2 years ago

The motivation of changing the priorities was to have a more realistic example. In Linux, interrupt threads often get priority 50, i.e., exactly (sched_get_priority_min(SCHED_FIFO) + sched_get_priority_max(SCHED_FIFO)) / 2.

I expect that in most real-world ROS-based application, priorities below this value are sufficient. The original priority of sched_get_priority_max(SCHED_FIFO) for the high-priority thread in this example is completely exaggerated, cf. my talk at last year's ROS World workshop on execution management (video, slides).

Please note that I implemented the examples_rclcpp_cbg_executor package, i.e., I'm correcting myself with this PR :-)