task_latcher.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:needybot-core 作者: needybot 项目源码 文件源码
def latch_timer(self, step_name, tmr_id, duration, cb, oneshot=False):
        step_dict = self.get_step_dict(step_name)

        def handle_evt(evt):
            if self.step == step_name:
                cb(evt)

        timers = step_dict.get('timers', {})
        # Shutdown old timer with same ID if it exists
        timer = timers.get(tmr_id, None)
        if timer and timer.is_alive(): timer.shutdown()

        timer = rospy.Timer(duration, handle_evt, oneshot=oneshot)
        timers[tmr_id] = timer
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号