examples_rclpy_executors.custom_callback_group module
- class examples_rclpy_executors.custom_callback_group.ThrottledCallbackGroup(*args: Any, **kwargs: Any)
Bases:
CallbackGroup
Throttle callbacks using a token bucket.
Callback groups are responsible for controlling when callbacks are allowed to be executed. rclpy provides two groups: one which always allows a callback to be executed, and another which allows only one callback to be executed at a time. If neither of these are sufficient then a custom callback group should be used instead.
- beginning_execution(entity)
Get permission from the group to execute a callback for an entity.
- Parameters:
entity – A timer, subscriber, client, or service instance
- Rtype bool:
true if the executor has permission to execute it
- can_execute(entity)
Ask group if this entity could be executed.
- Parameters:
entity – A timer, subscriber, client, or service instance
- Rtype bool:
true if a callback can be executed
- ending_execution(entity)
Notify group that a callback finished executing.
- Parameters:
entity – A timer, subscriber, client, or service instance
- timer_callback()
Replenish the tokens in the bucket at a steady rate.
- class examples_rclpy_executors.custom_callback_group.ThrottledTalker(*args: Any, **kwargs: Any)
Bases:
Node
A Node which uses a custom callback group.
- timer_callback()
- examples_rclpy_executors.custom_callback_group.main(args=None)