本文整理汇总了Python中Timer.Timer.add_task方法的典型用法代码示例。如果您正苦于以下问题:Python Timer.add_task方法的具体用法?Python Timer.add_task怎么用?Python Timer.add_task使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer.Timer
的用法示例。
在下文中一共展示了Timer.add_task方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Timer import Timer [as 别名]
# 或者: from Timer.Timer import add_task [as 别名]
def __init__(self, tank_index, target_color, state):
self.state = state
self.target_color = target_color
self.tank_index = tank_index
self.pdc = PDController()
self.timer_id = Timer.add_task(self.update)
self.kvis = KalmanVisualizer(800, 800)
self.kfilter = KalmanFilter()
示例2: __init__
# 需要导入模块: from Timer import Timer [as 别名]
# 或者: from Timer.Timer import add_task [as 别名]
def __init__(self, tank_index, flag_index, state):
self.tank_index = tank_index
self.flag_index = flag_index
self.state = state
self.timer_id = Timer.add_task(self.potential_fields_move)
self.pfc = self.setup_potential_fields()
self.pdcontroller = PDController()
self.attacking = True
self.prev_x = 0
self.prev_y = 0
self.time_spent_stuck = 0 # stuck for more than 10 seconds, get a new random vector
self.time_without_moving = 0 # consider ourselves stuck only after 5 seconds
self.stuck_vector = [0, 0]
self.stuck = False