ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A

ROS2 Package Migration: Replacement for CallbackQueueInterface

I am looking at porting tf2_ros/include/message_filter.h from ROS1 to ROS2 (see issue:

The existing tf2 message_filter.h relies on using the CallbackQueueInterface in order to enqueue messages that it receives before they are sent on to subsequent filters/callbacks. It appears that ROS2 has changed the concept of a node have a single CallbackQueue to a node having multiple CallbackGroups that can have different thread locking mechanisms. This makes sense, but it is unclear to me how I can use a CallbackGroup instance to add a callback event to be processed. Are callback groups the proper way to handle this in ROS2 or is there a different mechanism that should be used to decouple two filters in a chain from being run in the same thread context? If CallbackGroups are the proper way to do this then how do you actually add a Callback to the group in order for it to be processed?


If anyone runs into this I’ve answered this question at: