OpenRTM_aist
test
test_ExtTrigExecutionContext.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
# -*- Python -*-
3
4
#
5
# \file test_ExtTrigExecutionContext.py
6
# \brief ExtTrigExecutionContext class
7
# \date $Date: 2007/09/06$
8
# \author Shinji Kurihara
9
#
10
# Copyright (C) 2007
11
# Task-intelligence Research Group,
12
# Intelligent Systems Research Institute,
13
# National Institute of
14
# Advanced Industrial Science and Technology (AIST), Japan
15
# All rights reserved.
16
#
17
18
import
sys
19
sys.path.insert(1,
"../"
)
20
import
threading
21
22
import
unittest
23
import
OpenRTM_aist
24
import
RTC, RTC__POA
25
26
from
ExtTrigExecutionContext
import
*
27
28
from
omniORB
import
CORBA, PortableServer
29
30
class
DFP
(
OpenRTM_aist.RTObject_impl
):
31
def
__init__
(self):
32
self.
_orb
= CORBA.ORB_init()
33
self.
_poa
= self.
_orb
.resolve_initial_references(
"RootPOA"
)
34
OpenRTM_aist.RTObject_impl.__init__(self, orb=self.
_orb
, poa=self.
_poa
)
35
self.
_error
=
False
36
self.
_ref
= self._this()
37
self.
_eclist
= []
38
39
def
on_execute
(self, ec_id):
40
return
RTC.RTC_OK
41
42
class
TestExtTrigExecutionContext
(unittest.TestCase):
43
def
setUp
(self):
44
self.
_dfp
=
DFP
()
45
self.
_dfp
._poa._get_the_POAManager().activate()
46
self.
etec
=
ExtTrigExecutionContext
()
47
#self.etec = ExtTrigExecutionContext(self._dfp._ref)
48
49
def
tearDown
(self):
50
OpenRTM_aist.Manager.instance().shutdownManager()
51
return
52
53
def
test_tick
(self):
54
pass
55
56
def
test_run
(self):
57
self.assertEqual(self.etec.start(),RTC.RTC_OK)
58
self.assertEqual(self.etec.add_component(self._dfp._this()),RTC.RTC_OK)
59
self.assertEqual(self.etec.activate_component(self._dfp._this()),RTC.RTC_OK)
60
import
time
61
time.sleep(1)
62
self.etec.tick()
63
self.etec.tick()
64
time.sleep(1)
65
self.assertEqual(self.etec.deactivate_component(self._dfp._this()),RTC.RTC_OK)
66
time.sleep(1)
67
self.assertEqual(self.etec.remove_component(self._dfp._this()),RTC.RTC_OK)
68
th = threading.Thread(target=self.stop)
69
th.start()
70
self.etec.tick()
71
if
th:
72
th.join()
73
self._dfp._poa.deactivate_object(self._dfp._poa.servant_to_id(self.etec))
74
self._dfp._poa.deactivate_object(self._dfp._poa.servant_to_id(self._dfp))
75
76
def
stop
(self):
77
self.
etec
.
stop
()
78
79
80
if
__name__ ==
'__main__'
:
81
unittest.main()
OpenRTM_aist.RTObject.RTObject_impl._eclist
_eclist
Definition:
RTObject.py:124
OpenRTM_aist.RTObject.RTObject_impl._orb
_orb
Definition:
RTObject.py:94
test_ExtTrigExecutionContext.DFP.__init__
def __init__(self)
Definition:
test_ExtTrigExecutionContext.py:31
test_ExtTrigExecutionContext.TestExtTrigExecutionContext.tearDown
def tearDown(self)
Definition:
test_ExtTrigExecutionContext.py:49
test_ExtTrigExecutionContext.DFP.on_execute
def on_execute(self, ec_id)
[DataFlowComponentAction CORBA interface] Primary Periodic Operation of RTC
Definition:
test_ExtTrigExecutionContext.py:39
test_ExtTrigExecutionContext.DFP._ref
_ref
Definition:
test_ExtTrigExecutionContext.py:36
test_ExtTrigExecutionContext.TestExtTrigExecutionContext
Definition:
test_ExtTrigExecutionContext.py:42
test_ExtTrigExecutionContext.DFP._error
_error
Definition:
test_ExtTrigExecutionContext.py:35
test_ExtTrigExecutionContext.TestExtTrigExecutionContext.test_tick
def test_tick(self)
Definition:
test_ExtTrigExecutionContext.py:53
test_ExtTrigExecutionContext.TestExtTrigExecutionContext._dfp
_dfp
Definition:
test_ExtTrigExecutionContext.py:44
test_ExtTrigExecutionContext.TestExtTrigExecutionContext.setUp
def setUp(self)
Definition:
test_ExtTrigExecutionContext.py:43
test_ExtTrigExecutionContext.TestExtTrigExecutionContext.test_run
def test_run(self)
Definition:
test_ExtTrigExecutionContext.py:56
test_ExtTrigExecutionContext.TestExtTrigExecutionContext.etec
etec
Definition:
test_ExtTrigExecutionContext.py:46
test_ExtTrigExecutionContext.TestExtTrigExecutionContext.stop
def stop(self)
Definition:
test_ExtTrigExecutionContext.py:76
OpenRTM_aist.RTObject.RTObject_impl._poa
_poa
Definition:
RTObject.py:95
OpenRTM_aist.RTObject.RTObject_impl
Definition:
RTObject.py:68
test_ExtTrigExecutionContext.DFP
Definition:
test_ExtTrigExecutionContext.py:30
ExtTrigExecutionContext
openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Mon Apr 21 2025 02:45:06