OpenRTM_aist
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
40
class
ExtTrigExecutionContext
(
OpenRTM_aist.PeriodicExecutionContext
):
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
155
def
ExtTrigExecutionContextInit
(manager):
156
manager.registerECFactory(
"ExtTrigExecutionContext"
,
157
OpenRTM_aist.ExtTrigExecutionContext
,
158
OpenRTM_aist.ECDelete)
OpenRTM_aist.PeriodicExecutionContext.PeriodicExecutionContext._running
_running
Definition:
PeriodicExecutionContext.py:360
OpenRTM_aist.ExtTrigExecutionContext.ExtTrigExecutionContext.Worker._cond
_cond
Definition:
ExtTrigExecutionContext.py:140
OpenRTM_aist.ExtTrigExecutionContext.ExtTrigExecutionContext.tick
def tick(self)
Definition:
ExtTrigExecutionContext.py:72
OpenRTM_aist.ExtTrigExecutionContext.ExtTrigExecutionContext.Worker._called
_called
Definition:
ExtTrigExecutionContext.py:141
OpenRTM_aist.ExtTrigExecutionContext.ExtTrigExecutionContext._rtcout
_rtcout
Definition:
ExtTrigExecutionContext.py:59
OpenRTM_aist.ExtTrigExecutionContext.ExtTrigExecutionContext.Worker.__init__
def __init__(self)
Constructor.
Definition:
ExtTrigExecutionContext.py:138
OpenRTM_aist.PeriodicExecutionContext.PeriodicExecutionContext._period
_period
Definition:
PeriodicExecutionContext.py:367
OpenRTM_aist.ExtTrigExecutionContext.ExtTrigExecutionContext.Worker
Definition:
ExtTrigExecutionContext.py:123
OpenRTM_aist.PeriodicExecutionContext.PeriodicExecutionContext
PeriodicExecutionContext class.
Definition:
PeriodicExecutionContext.py:43
OpenRTM_aist.ExtTrigExecutionContext.ExtTrigExecutionContext.__init__
def __init__(self)
Constructor.
Definition:
ExtTrigExecutionContext.py:56
OpenRTM_aist.PeriodicExecutionContext.PeriodicExecutionContext._comps
_comps
Definition:
PeriodicExecutionContext.py:379
OpenRTM_aist.ExtTrigExecutionContext.ExtTrigExecutionContext.Worker._mutex
_mutex
Definition:
ExtTrigExecutionContext.py:139
OpenRTM_aist.ExtTrigExecutionContext.ExtTrigExecutionContext
Definition:
ExtTrigExecutionContext.py:40
OpenRTM_aist.ExtTrigExecutionContext.ExtTrigExecutionContextInit
def ExtTrigExecutionContextInit(manager)
Definition:
ExtTrigExecutionContext.py:155
OpenRTM_aist.ExtTrigExecutionContext.ExtTrigExecutionContext._worker
_worker
Definition:
ExtTrigExecutionContext.py:58
OpenRTM_aist.ExtTrigExecutionContext.ExtTrigExecutionContext.svc
def svc(self)
Definition:
ExtTrigExecutionContext.py:94
openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Mon Feb 28 2022 23:01:06