ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

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

asked 2018-08-17 11:52:57 -0500

nburek gravatar image

I am looking at porting tf2_ros/include/message_filter.h from ROS1 to ROS2 (see issue: 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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-08-21 16:54:32 -0500

tfoote gravatar image

I believe you understand the way we intended for it to work.

Unfortunately at the moment the API is not completely there for how we'd like it to work. We've ticketed the upgrade needed to the API on rclcpp here:

There is potentially a hack to create another node and add things to it. But we'd want to get rid of that as soon as #519 above is resolved.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-08-17 11:52:57 -0500

Seen: 1,555 times

Last updated: Aug 21 '18