New chapter on multithreading

Hello,

Good to see that the courses are actively being expanded to cover new topics.

[EDIT: first post mentioned an error, but it was a mistake on my side as I ran locally without simulation]

On a more general note:

The examples show a timer at 2Hz with a callback that takes longer than 0,5s. It is obvious that this cannot work; even with multiple executors or multithreaded executors the timer will never reach its set frequency. Even though this is irrelevant wrt the issue that you want to explain (being that one callback blocks another while it runs), I think this might be confusing to new users.

Imo this could be a better example:

  • One node with:

    • A timer that prints a message at 2Hz (without sleep()), and
    • A subscriber callback that prints a message and sleeps for 3 seconds (as a mockup for a long-running calculation on the message, e.g. complex inverse kinematics, or some path optimization routine, etc).
  • A publisher (in another executable) that publishes at a rate less than 1/3 Hz.
    (Or just sending messages manually with ros2 topic pub).

For this example:

  • The publisher does not publish at a faster pace than the subscriber can process,
  • Yet the timer callbacks will still be blocked during the execution of the subscriber callback.

Regards,
Johan

1 Like

Hello Johan,

Very interesting comments. We will definitely look into this in the following days/weeks and modify the unit accordingly to avoid any confusion. Many thanks for your detailed feedback.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.