Ejemplo n.º 1
0
    def __init__(
        self,
        *,
        callback_group: CallbackGroup,
        callback: Callable,
        event_type: IntEnum,
        parent_handle: Handle,
    ):
        # Waitable init adds self to callback_group
        super().__init__(callback_group)
        self.event_type = event_type
        self.callback = callback

        self._parent_handle = parent_handle
        with parent_handle as parent_capsule:
            event_capsule = _rclpy.rclpy_create_event(event_type,
                                                      parent_capsule)
        self._event_handle = Handle(event_capsule)
        self._ready_to_take_data = False
        self._event_index = None
Ejemplo n.º 2
0
 def _create_event_handle(self, parent_entity, event_type):
     with parent_entity.handle as parent_capsule:
         event_capsule = _rclpy.rclpy_create_event(event_type, parent_capsule)
     self.assertIsNotNone(event_capsule)
     return Handle(event_capsule)