Fix "roscpp multithreaded spinners eat up CPU when callbacks take too long"#2377
Conversation
* Better fix for slow callbacks CPU throttling. * More versatile callback queue test. * Finished cherry-pick merge to melodic-devel. * libros: moved define * roscpp: implementet ros#1608 without ABI/API breaks * /test_roscpp: fake_message is in a header now... * test_roscpp: fixed sign-compare warning * stabilized test * CallbackQueue: use SteadyTime instead of WallTime to get independent of system-time changes * style only * Update clients/roscpp/include/ros/callback_queue.h Co-authored-by: Johannes Meyer <johannes@intermodalics.eu> Co-authored-by: Martin Pecka <peci1@seznam.cz> Co-authored-by: CTU base <robot@ctu-base> Co-authored-by: Martin Pecka <peckama2@fel.cvut.cz> Co-authored-by: Christopher Wecht <christopher.wechtstudent.kit.edu> Co-authored-by: Dirk Thomas <dirk-thomas@users.noreply.github.com> Co-authored-by: Johannes Meyer <johannes@intermodalics.eu>
* roscpp: simplify implementation of CallbackQueue::callOne() Replace duplicate wait_for() call in CallbackQueue::callOne() with a loop and a call to wait_until(). * roscpp: return TryAgain from CallbackQueue::callOne(timeout) immediately if timeout.isZero() ... and if none of the other result conditions holds (i.e. the queue is Empty or Disabled). Co-authored-by: Johannes Meyer <johannes@intermodalics.eu>
|
Thank you for the PR! ROS Noetic will reach end-of-life on May 31st, 2025. Every change comes with a risk of introducing regressions, and there isn't much time left to fix them. To make sure this PR doesn't introduce any regressions please:
|
|
I assume this is an automatic near end-of-life message posted to all pending pull requests? The patches were reviewed, tested and merged into |
peci1
left a comment
There was a problem hiding this comment.
I've tested this PR locally.
All tests from test_roscpp succeed.
I also ran our student autonomous exploration pipeline (Turtlebot 3 in Gazebo Classic + custom control code) and everything seems to run correctly.
As this is a forward-port from Melodic, I guess it should not do any undiscovered harm.
|
Thanks for trying it out @peci1 ! |
Resolves #2341:
These two commits were cherry-picked from branch
melodic-devel, with some merge conflict resolutions intest/test_roscpp/test/test_callback_queue.cppdue to updates in #2121.Not sure whether #2121 resolving #1980 is related and would not even have been necessary with these two commits from
melodic-devel? I have not checked those two in detail yet.