ComponentObserverProvider.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: euc-jp -*-
3 
4 
17 
18 import sys
19 
20 from omniORB import CORBA, PortableServer
21 import RTC
22 import OpenRTM, OpenRTM__POA
23 import SDOPackage
24 import OpenRTM_aist
25 
26 class ComponentObserver_i(OpenRTM__POA.ComponentObserver):
27  def __init__(self):
28  pass
29 
30  def update_status(self, status_kind, hint):
31  print "update_status: ", status_kind, ", ", hint
32  return
33 
34 def main():
35  orb = CORBA.ORB_init(sys.argv)
36  poa = orb.resolve_initial_references("RootPOA")
37  poa._get_the_POAManager().activate()
38  naming = OpenRTM_aist.CorbaNaming(orb, "localhost")
39  servant = ComponentObserver_i()
40  oid = poa.servant_to_id(servant)
41  provider = poa.id_to_reference(oid)
42 
43  rtc = naming.resolve("ConsoleIn0.rtc")._narrow(RTC.RTObject)
44  config = rtc.get_configuration()
45  properties = [OpenRTM_aist.NVUtil.newNV("heartbeat.enable","YES"),
46  OpenRTM_aist.NVUtil.newNV("heartbeat.interval","10"),
47  OpenRTM_aist.NVUtil.newNV("observed_status","ALL")]
48 
49  id = OpenRTM_aist.toTypename(servant)
50  sprof = SDOPackage.ServiceProfile("test_id", id,
51  properties, provider)
52 
53  ret = config.add_service_profile(sprof)
54  flag = True
55  print "If you exit program, please input 'q'."
56  sys.stdin.readline()
57  ret = config.remove_service_profile("test_id")
58  print "test program end. ret : ", ret
59  return
60 
61 
62 if __name__ == '__main__':
63  main()
CORBA Naming Service helper class.
Definition: CorbaNaming.py:61
def newNV(name, value)
Create NameVale.
Definition: NVUtil.py:50


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Mon Feb 28 2022 23:01:06