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

What is the difference between callback_group and callback_event when creating a publisher?

asked 2021-10-21 17:58:46 -0500

JollyRogers gravatar image

The documentation of the Node class defines the create_publisher function as follows:

create_publisher(msg_type, topic, qos_profile, *, callback_group=None, event_callbacks=None)

Then, it defines the callback_group as follows: The callback group for the publisher’s event handlers. If None, then the node’s default callback group is used.

Also defines the callback_event as: User-defined callbacks for middleware events.

I understand that the callback_event is a function created by the user. However, I am not sure what the calback_group does.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2021-10-21 19:24:15 -0500

Geoff gravatar image

The event callbacks are for middleware Quality of Service events such as a buffer being filled, a publication deadline being missed, or similar. You can see which events are available for publishers in the documentation here.

Callback groups are used to control how the callbacks are called. For example, they can be used to prevent two callbacks being entered at the same time if a multi-threaded executor is used. They are more important to subscribers, which have a callback for when data is received, than publishers, although publishers have QoS event callbacks that are relevant. Take a look at the documentation for the CallbackGroup object, which manages them, for more information about what they are and how to use them.

edit flag offensive delete link more

Comments

Thank you for your answer.

JollyRogers gravatar image JollyRogers  ( 2021-10-21 21:14:53 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-10-21 17:58:46 -0500

Seen: 176 times

Last updated: Oct 21 '21