SimpleService/run.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # -*- Python -*-
4 
5 #
6 # @file run.py
7 # @brief ExtTrigger example startup script
8 # @date $Date: 2007/10/26 $
9 #
10 # Copyright (c) 2003-2007 Noriaki Ando <n-ando@aist.go.jp> and Shinji Kurihara
11 # Task-intelligence Research Group,
12 # Intelligent System Research Institute,
13 # National Institute of Industrial Science (AIST), Japan
14 # All rights reserved.
15 #
16 
17 import sys,os,platform
18 import time
19 import commands
20 
21 nsport="2809"
22 sysinfo = platform.uname()
23 hostname= sysinfo[1]
24 plat=sys.platform
25 
26 if plat == "win32":
27  os.system("rd /S /Q SimpleService")
28  os.system("rd /S /Q SimpleService__POA")
29  os.system("omniidl.exe -bpython MyService.idl")
30  os.system("start python ..\\..\\..\\bin\\rtm-naming.py")
31  os.system("start python MyServiceConsumer.py")
32  os.system("start python MyServiceProvider.py")
33  time.sleep(3)
34  os.system("python Connector.py")
35 
36 else:
37  os.system('rm -rf SimpleService*')
38  os.system('omniidl -bpython MyService.idl')
39  status,term=commands.getstatusoutput("which xterm")
40  term += " -e"
41  if status != 0:
42  status,term=commands.getstatusoutput("which kterm")
43  term += " -e"
44 
45  if status != 0:
46  status,term=commands.getstatusoutput("which uxterm")
47  term += " -e"
48 
49  if status != 0:
50  status,term=commands.getstatusoutput("which gnome-terminal")
51  term += " -x"
52 
53  if status != 0:
54  print "No terminal program (kterm/xterm/gnome-terminal) exists."
55  sys.exit(0)
56 
57  path = None
58  for p in sys.path:
59  if os.path.exists(os.path.join(p,"OpenRTM_aist")):
60  path = os.path.join(p,"OpenRTM_aist","utils","rtm-naming")
61  break
62  if path is None:
63  print "rtm-naming directory not exist."
64  sys.exit(0)
65 
66  os.system('python %s/rtm-naming.py &'%path)
67  os.system('%s python MyServiceConsumer.py &'%term)
68  os.system('%s python MyServiceProvider.py &'%term)
69  time.sleep(3)
70  os.system("python Connector.py")


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