Пример #1
0
 def _run(self, _):
     """
     @brief Tick tasks at 25hz
     """
     BtTicker._finished_skill_ids = dict()
     rate = rospy.Rate(25)
     log.info("[BtTicker]", "Execution starts.")
     for uid in list(BtTicker._tasks.keys()):
         t = BtTicker._tasks[uid]
         printer = visitors.VisitorPrint(BtTicker._visitor._wm, BtTicker._visitor._instanciator)
         printer.traverse(t)
         self.publish_progress(uid, printer)
     while BtTicker._tasks:
         self._tick()
         rate.sleep()
         self._tick_cb()
     log.info("[BtTicker]", "Execution stops.")
Пример #2
0
 def _tick(self):
     visitor = BtTicker._visitor
     printer = visitors.VisitorPrint(BtTicker._visitor._wm,
                                     BtTicker._visitor._instanciator)
     for uid in list(BtTicker._tasks.keys()):
         if uid in BtTicker._tasks_to_preempt:
             BtTicker._tasks_to_preempt.remove(uid)
             visitor.preempt()
         if uid in BtTicker._tasks_to_pause.keys():
             if BtTicker._tasks_to_pause[uid] > 0:
                 BtTicker._tasks_to_pause[uid] -= 1
             else:
                 continue
         t = BtTicker._tasks[uid]
         result = visitor.traverse(t)
         printer.traverse(t)
         self.publish_progress(uid, printer)
         if result != State.Running and result != State.Idle:
             self.remove_task(uid)
Пример #3
0
 def print_task(self, uid):
     self.visitor = visitors.VisitorPrint(self._local_wm, self._instanciator)
     self.visitor.setVerbose(self._verbose)
     return self._ticker.start(self.visitor, uid)