synchros2.callback_groups module

class synchros2.callback_groups.NonReentrantCallbackGroup[source]

Bases: CallbackGroup

A callback group to prevent concurrent execution of the same callback while allowing it for different callbacks.

Note this behavior sits in between that offered by rclpy.callback_groups.MutuallyExclusiveCallbackGroup and rclpy.callback_groups.ReentrantCallbackGroup, as the former forbids concurrent execution and the latter allows it including multiple invocations of the same callback (e.g. a subscription handling multiple messages concurrently).

See rclpy.callback_groups.CallbackGroup documentation for further reference.

__init__() None[source]

Constructor

beginning_execution(entity: rclpy.executors.WaitableEntityType) bool[source]

Get permission for the callback from the group to begin executing an entity.

If this returns True then CallbackGroup.ending_execution must be called after the callback has been executed.

Arg:

entity:A subscription, timer, client, service, or waitable instance.

Returns:

True if the callback can be executed, False otherwise.

can_execute(entity: rclpy.executors.WaitableEntityType) bool[source]

Determine if a callback for an entity can be executed.

Parameters:

entity – A subscription, timer, client, service, or waitable instance.

Returns:

True if entity callback can be executed, False otherwise.

ending_execution(entity: rclpy.executors.WaitableEntityType) None[source]

Notify group that a callback has finished executing.

Parameters:

entity – A subscription, timer, client, service, or waitable instance.