コード例 #1
0
    def create_timer(self, timer_period_sec, callback):
        timer_period_nsec = int(float(timer_period_sec) * S_TO_NS)
        [timer_handle, timer_pointer] = _rclpy.rclpy_create_timer(timer_period_nsec)
        timer = WallTimer(timer_handle, timer_pointer, callback, timer_period_nsec)

        self.timers.append(timer)
        return timer
コード例 #2
0
 def __init__(self, callback, callback_group, timer_period_ns):
     [self.timer_handle,
      self.timer_pointer] = _rclpy.rclpy_create_timer(timer_period_ns)
     self.timer_period_ns = timer_period_ns
     self.callback = callback
     self.callback_group = callback_group
     # True when the callback is ready to fire but has not been "taken" by an executor
     self._executor_event = False
コード例 #3
0
 def __init__(self, callback, callback_group, timer_period_ns):
     # TODO(sloretz) Allow passing clocks in via timer constructor
     self._clock = Clock(clock_type=ClockType.STEADY_TIME)
     [self.timer_handle, self.timer_pointer
      ] = _rclpy.rclpy_create_timer(self._clock._clock_handle,
                                    timer_period_ns)
     self.timer_period_ns = timer_period_ns
     self.callback = callback
     self.callback_group = callback_group
     # True when the callback is ready to fire but has not been "taken" by an executor
     self._executor_event = False
コード例 #4
0
    def __init__(self, node):
        super().__init__(ReentrantCallbackGroup())

        self._clock = Clock(clock_type=ClockType.STEADY_TIME)
        period_nanoseconds = 10000
        self.timer = _rclpy.rclpy_create_timer(self._clock._clock_handle,
                                               period_nanoseconds)[0]
        self.timer_index = None
        self.timer_is_ready = False

        self.node = node
        self.future = None
コード例 #5
0
ファイル: test_waitable.py プロジェクト: wayneofspades/rclpy
    def __init__(self, node):
        super().__init__(ReentrantCallbackGroup())

        self._clock = Clock(clock_type=ClockType.STEADY_TIME)
        period_nanoseconds = 10000
        with self._clock.handle as clock_capsule, node.context.handle as context_capsule:
            self.timer = _rclpy.rclpy_create_timer(clock_capsule,
                                                   context_capsule,
                                                   period_nanoseconds)
        self.timer_index = None
        self.timer_is_ready = False

        self.node = node
        self.future = None
コード例 #6
0
 def __init__(self,
              callback,
              callback_group,
              timer_period_ns,
              clock,
              *,
              context=None):
     self._context = get_default_context() if context is None else context
     self._clock = clock
     with self._clock.handle as clock_capsule, self._context.handle as context_capsule:
         self.__handle = Handle(
             _rclpy.rclpy_create_timer(clock_capsule, context_capsule,
                                       timer_period_ns))
     self.timer_period_ns = timer_period_ns
     self.callback = callback
     self.callback_group = callback_group
     # True when the callback is ready to fire but has not been "taken" by an executor
     self._executor_event = False
コード例 #7
0
ファイル: timer.py プロジェクト: xhuan28/rclpy
 def __init__(self,
              callback,
              callback_group,
              timer_period_ns,
              *,
              context=None):
     self._context = get_default_context() if context is None else context
     # TODO(sloretz) Allow passing clocks in via timer constructor
     self._clock = Clock(clock_type=ClockType.STEADY_TIME)
     with self._clock.handle as clock_capsule:
         self.__handle = Handle(
             _rclpy.rclpy_create_timer(clock_capsule, self._context.handle,
                                       timer_period_ns))
     self.__handle.requires(self._clock.handle)
     self.timer_period_ns = timer_period_ns
     self.callback = callback
     self.callback_group = callback_group
     # True when the callback is ready to fire but has not been "taken" by an executor
     self._executor_event = False
コード例 #8
0
ファイル: timer.py プロジェクト: iamsile/ros2-for-os
 def __init__(self, timer_handle, timer_pointer, callback, timer_period_ns):
     [self.timer_handle,
      self.timer_pointer] = _rclpy.rclpy_create_timer(timer_period_ns)
     self.timer_period_ns = timer_period_ns
     self.callback = callback
コード例 #9
0
ファイル: timer.py プロジェクト: ros2/rclpy
 def __init__(self, timer_handle, timer_pointer, callback, timer_period_ns):
     [self.timer_handle, self.timer_pointer] = _rclpy.rclpy_create_timer(timer_period_ns)
     self.timer_period_ns = timer_period_ns
     self.callback = callback