ROS Callback Group
First saw this when developing for MIT-PITT-RW.
https://docs.ros.org/en/humble/How-To-Guides/Using-callback-groups.html
- I really need to understand why their example doesn’t work
Risk of Deadlock
what it boils down to
Basically, don’t trigger a callback within a callback. Because if they are both mutually exclusive callback group (the default), this would result in a deadlock, and the second callback cannot run until the first callback is finished.
- With the default setting above (both being nullptr / None), both the timer and the client will use the node’s default Mutually Exclusive Callback Group.
So what is the correct way?
Create 2 new mutual exclusive callback groups
The default callback group isa mutually exclusive callback group.
If two callbacks are in the same mutually exclusive callback group, ROS will make sure that they won’t be executed at the same time.
Seems like it was because they were running into DDS buffering issues?
When running a node in a Multi-Threaded Executor, ROS 2 offers two different types of callback groups for controlling execution of callbacks:
- Mutually Exclusive Callback Group
- Reentrant Callback Group