Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do you use CallbackGroups as a replacement for CallbackQueues in ROS2?

I am looking at porting tf2_ros/include/message_filter.h from ROS1 to ROS2 (see issue: https://github.com/ros2/geometry2/issues/59 2).

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?

Thanks, Nick