ExtTrigExecutionContext.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: euc-jp -*-
3 
4 
16 
17 
18 
19 import threading
20 import time
21 
22 import OpenRTM_aist
23 
24 
25 
26 
41  """
42  """
43 
44 
45 
56  def __init__(self):
57  OpenRTM_aist.PeriodicExecutionContext.__init__(self)
58  self._worker = self.Worker()
59  self._rtcout = OpenRTM_aist.Manager.instance().getLogbuf("rtobject.exttrig_ec")
60 
61 
72  def tick(self):
73  self._rtcout.RTC_TRACE("tick()")
74  if not self._worker._cond.acquire():
75  return
76  self._worker._called = True
77  self._worker._cond.notify()
78  self._worker._cond.release()
79  return
80 
81 
94  def svc(self):
95  self._rtcout.RTC_TRACE("svc()")
96  flag = True
97 
98  while flag:
99  sec_ = float(self._period.usec())/1000000.0
100  self._worker._cond.acquire()
101  while not self._worker._called and self._running:
102  self._worker._cond.wait()
103  if self._worker._called:
104  self._worker._called = False
105  for comp in self._comps:
106  comp._sm.worker()
107 
108  self._worker._cond.release()
109  flag = self._running
110 
111 
123  class Worker:
124  """
125  """
126 
127 
138  def __init__(self):
139  self._mutex = threading.RLock()
140  self._cond = threading.Condition(self._mutex)
141  self._called = False
142 
143 
144 
145 
156  manager.registerECFactory("ExtTrigExecutionContext",
158  OpenRTM_aist.ECDelete)


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Thu Jun 6 2019 19:11:34