-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexitRTCs.py
74 lines (51 loc) · 1.51 KB
/
exitRTCs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- Python -*-
"""
@file exitRTCs.py
@brief rtcConfSetReq.rtcとmanager_composite.mgrを終了させる
"""
import os.path
import sys, traceback
import time
import struct
import rtctree.tree
import rtctree.path
# Import RTM module
import RTC
import OpenRTM_aist
##
# @brief rtcConfSetReq.rtcとmanager_composite.mgrを終了させる
# @param node ノード
def getNode(node):
#values = node._children.values()
values = node.children
for v in values:
if v.is_component:
if v.name == "rtcConfSetReq0.rtc" or v.name == "rtcConfSet0.rtc" or v.name == "rtcdControl0.rtc" or v.name == "rtcdControlPy0.rtc":
try:
v.exit()
except:
info = sys.exc_info()
tbinfo = traceback.format_tb( info[2] )
for tbi in tbinfo:
print tbi
elif v.is_manager:
if v.name == "manager_composite.mgr":
try:
v.shutdown()
except:
info = sys.exc_info()
tbinfo = traceback.format_tb( info[2] )
for tbi in tbinfo:
print tbi
else:
getNode(v)
##
# @brief メイン関数
def main():
path = ['/', 'localhost']
tree = rtctree.tree.RTCTree(servers='localhost')
getNode(tree.get_node(path))
if __name__ == "__main__":
main()