RTObject.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: euc-jp -*-
3 
4 
16 
17 
18 
19 import string
20 import sys
21 import copy
22 
23 from omniORB import any
24 from omniORB import CORBA
25 
26 import OpenRTM__POA
27 import RTC
28 import SDOPackage
29 import OpenRTM_aist
30 
31 ECOTHER_OFFSET = 1000
32 
33 default_conf = [
34  "implementation_id","",
35  "type_name", "",
36  "description", "",
37  "version", "",
38  "vendor", "",
39  "category", "",
40  "activity_type", "",
41  "max_instance", "",
42  "language", "",
43  "lang_type", "",
44  "conf", "",
45  "" ]
46 
47 
48 
49 
68 class RTObject_impl(OpenRTM__POA.DataFlowComponent):
69  """
70  """
71 
72 
91  def __init__(self, manager=None, orb=None, poa=None):
92  if manager:
93  self._manager = manager
94  self._orb = self._manager.getORB()
95  self._poa = self._manager.getPOA()
96  self._portAdmin = OpenRTM_aist.PortAdmin(self._manager.getORB(),self._manager.getPOA())
97  else:
98  self._manager = None
99  self._orb = orb
100  self._poa = poa
101  self._portAdmin = OpenRTM_aist.PortAdmin(self._orb,self._poa)
102 
103  if self._manager:
104  self._rtcout = self._manager.getLogbuf("rtobject")
105  else:
106  self._rtcout = OpenRTM_aist.Manager.instance().getLogbuf("rtobject")
107 
108  self._created = True
109  self._properties = OpenRTM_aist.Properties(defaults_str=default_conf)
110  self._configsets = OpenRTM_aist.ConfigAdmin(self._properties.getNode("conf"))
111  self._profile = RTC.ComponentProfile("","","","","","",[],None,[])
112 
115  self._SdoConfig = self._SdoConfigImpl.getObjRef()
116  self._execContexts = []
117  self._objref = self._this()
118  self._sdoOwnedOrganizations = [] #SDOPackage.OrganizationList()
119  self._sdoSvcProfiles = [] #SDOPackage.ServiceProfileList()
120  self._sdoOrganizations = [] #SDOPackage.OrganizationList()
121  self._sdoStatus = [] #SDOPackage.NVList()
122  self._ecMine = []
123  self._ecOther = []
124  self._eclist = []
125  self._exiting = False
126  self._readAll = False
127  self._writeAll = False
128  self._readAllCompletion = False
129  self._writeAllCompletion = False
130  self._inports = []
131  self._outports = []
134  return
135 
136 
137 
149  def __del__(self):
150  return
151 
152 
153  #============================================================
154  # Overridden functions
155  #============================================================
156 
157 
175  def onInitialize(self):
176  self._rtcout.RTC_TRACE("onInitialize()")
177  return RTC.RTC_OK
178 
179 
180 
198  def onFinalize(self):
199  self._rtcout.RTC_TRACE("onFinalize()")
200  return RTC.RTC_OK
201 
202 
203 
222  def onStartup(self, ec_id):
223  self._rtcout.RTC_TRACE("onStartup(%d)",ec_id)
224  return RTC.RTC_OK
225 
226 
227 
246  def onShutdown(self, ec_id):
247  self._rtcout.RTC_TRACE("onShutdown(%d)",ec_id)
248  return RTC.RTC_OK
249 
250 
251 
270  def onActivated(self, ec_id):
271  self._rtcout.RTC_TRACE("onActivated(%d)",ec_id)
272  return RTC.RTC_OK
273 
274 
275 
294  def onDeactivated(self, ec_id):
295  self._rtcout.RTC_TRACE("onDeactivated(%d)",ec_id)
296  return RTC.RTC_OK
297 
298 
299 
320  def onExecute(self, ec_id):
321  self._rtcout.RTC_TRACE("onExecute(%d)",ec_id)
322  return RTC.RTC_OK
323 
324 
325 
344  def onAborting(self, ec_id):
345  self._rtcout.RTC_TRACE("onAborting(%d)",ec_id)
346  return RTC.RTC_OK
347 
348 
349 
367  def onError(self, ec_id):
368  self._rtcout.RTC_TRACE("onError(%d)",ec_id)
369  return RTC.RTC_OK
370 
371 
372 
390  def onReset(self, ec_id):
391  self._rtcout.RTC_TRACE("onReset(%d)",ec_id)
392  return RTC.RTC_OK
393 
394 
395 
416  def onStateUpdate(self, ec_id):
417  self._rtcout.RTC_TRACE("onStateupdate(%d)",ec_id)
418  return RTC.RTC_OK
419 
420 
421 
442  def onRateChanged(self, ec_id):
443  self._rtcout.RTC_TRACE("onRatechanged(%d)",ec_id)
444  return RTC.RTC_OK
445 
446 
447  #============================================================
448  # RTC::LightweightRTObject
449  #============================================================
450 
451 
487  def initialize(self):
488  self._rtcout.RTC_TRACE("initialize()")
489 
490  ec_args = self._properties.getProperty("exec_cxt.periodic.type")
491  ec_args += "?"
492  ec_args += "rate="
493  ec_args += self._properties.getProperty("exec_cxt.periodic.rate")
494 
495  ec = OpenRTM_aist.Manager.instance().createContext(ec_args)
496  if ec is None:
497  return RTC.RTC_ERROR
498 
499  ec.set_rate(float(self._properties.getProperty("exec_cxt.periodic.rate")))
500  self._eclist.append(ec)
501  ecv = ec.getObjRef()
502  if CORBA.is_nil(ecv):
503  return RTC.RTC_ERROR
504 
505  ec.bindComponent(self)
506 
507  # at least one EC must be attached
508  if len(self._ecMine) == 0:
509  return RTC.PRECONDITION_NOT_MET
510 
511  ret = self.on_initialize()
512  if ret is not RTC.RTC_OK:
513  return ret
514  self._created = False
515 
516  # -- entering alive state --
517  for i in range(len(self._ecMine)):
518  self._rtcout.RTC_DEBUG("EC[%d] starting.", i)
519  self._ecMine[i].start()
520 
521  # ret must be RTC_OK
522  return ret
523 
524 
525 
570  def finalize(self):
571  self._rtcout.RTC_TRACE("finalize()")
572  if self._created or not self._exiting:
573  return RTC.PRECONDITION_NOT_MET
574 
575  # Return RTC::PRECONDITION_NOT_MET,
576  # When the component is registered in ExecutionContext.
577  if len(self._ecOther) != 0:
578  for ec in self._ecOther:
579  if not CORBA.is_nil(ec):
580  return RTC.PRECONDITION_NOT_MET
581 
582  self._ecOther = []
583 
584  ret = self.on_finalize()
585  self.shutdown()
586  return ret
587 
588 
589 
633  def exit(self):
634  self._rtcout.RTC_TRACE("exit()")
635  if self._created:
636  return RTC.PRECONDITION_NOT_MET
637 
638  # deactivate myself on owned EC
640  self.deactivate_comps(self._objref))
641  # deactivate myself on other EC
643  self.deactivate_comps(self._objref))
644 
645  # stop and detach myself from owned EC
646  for ec in self._ecMine:
647  if not CORBA.is_nil(ec) or not ec._non_existent():
648  # ret = ec.stop()
649  # ec.remove_component(self._this())
650  pass
651 
652  # detach myself from other EC
653  for ec in self._ecOther:
654  if not CORBA.is_nil(ec):
655  # ec.stop()
656  ec.remove_component(self._this())
657 
658  self._exiting = True
659  return self.finalize()
660 
661 
662 
698  def is_alive(self, exec_context):
699  self._rtcout.RTC_TRACE("is_alive()")
700  for ec in self._ecMine:
701  if exec_context._is_equivalent(ec):
702  return True
703 
704  for ec in self._ecOther:
705  if not CORBA.is_nil(ec):
706  if exec_context._is_equivalent(ec):
707  return True
708 
709  return False
710 
711 
712 
734 
735 
736 
764  def get_context(self, ec_id):
765  global ECOTHER_OFFSET
766 
767  self._rtcout.RTC_TRACE("get_context(%d)", ec_id)
768  # owned EC
769  if ec_id < ECOTHER_OFFSET:
770  if ec_id < len(self._ecMine):
771  return self._ecMine[ec_id]
772  else:
773  return RTC.ExecutionContext._nil
774 
775  # participating EC
776  index = ec_id - ECOTHER_OFFSET
777 
778  if index < len(self._ecOther):
779  if not CORBA.is_nil(self._ecOther[index]):
780  return self._ecOther[index]
781 
782  return RTC.ExecutionContext._nil
783 
784 
785 
804  self._rtcout.RTC_TRACE("get_owned_contexts()")
805  execlist = []
807  return execlist
808 
809 
828  self._rtcout.RTC_TRACE("get_participating_contexts()")
829  execlist = []
831  return execlist
832 
833 
834  #
835  # @if jp
836  # @brief [CORBA interface] ExecutionContext �Υϥ�ɥ���֤�
837  #
838  # @param ExecutionContext �¹ԥ���ƥ����� # # @return ExecutionContextHandle # # Ϳ����줿�¹ԥ���ƥ����Ȥ˴�Ϣ�դ���줿�ϥ�ɥ���֤��� # # @else # @brief [CORBA interface] Return a handle of a ExecutionContext # # @param ExecutionContext # # @return ExecutionContextHandle # # This operation returns a handle that is associated with the given # execution context. # # @endif # # virtual ExecutionContextHandle_t # get_context_handle(ExecutionContext_ptr cxt) def get_context_handle(self, cxt): self._rtcout.RTC_TRACE("get_context_handle()") num = OpenRTM_aist.CORBA_SeqUtil.find(self._ecMine, self.ec_find(cxt)) if num != -1: return long(num) num = OpenRTM_aist.CORBA_SeqUtil.find(self._ecOther, self.ec_find(cxt)) if num != -1: return long(num) return long(-1) #============================================================ # RTC::RTObject #============================================================ ## # @if jp # # @brief [RTObject CORBA interface] ����ݡ��ͥ�ȥץ��ե������������� # # ��������ݡ��ͥ�ȤΥץ��ե����������֤��� # # @param self # # @return ����ݡ��ͥ�ȥץ��ե����� # # @else # # @brief [RTObject CORBA interface] Get RTC's profile # # This operation returns the ComponentProfile of the RTC # # @return ComponentProfile # # @endif # virtual ComponentProfile* get_component_profile() def get_component_profile(self): self._rtcout.RTC_TRACE("get_component_profile()") try: prop_ = RTC.ComponentProfile(self._properties.getProperty("instance_name"), self._properties.getProperty("type_name"), self._properties.getProperty("description"), self._properties.getProperty("version"), self._properties.getProperty("vendor"), self._properties.getProperty("category"), self._portAdmin.getPortProfileList(), self._profile.parent, self._profile.properties) OpenRTM_aist.NVUtil.copyFromProperties(self._profile.properties, self._properties) return prop_ # return RTC.ComponentProfile(self._profile.instance_name, # self._profile.type_name, # self._profile.description, # self._profile.version, # self._profile.vendor, # self._profile.category, # self._portAdmin.getPortProfileList(), # self._profile.parent, # self._profile.properties) except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) assert(False) return None ## # @if jp # # @brief [RTObject CORBA interface] �ݡ��Ȥ�������� # # ��������ݡ��ͥ�Ȥ���ͭ����ݡ��Ȥλ��Ȥ��֤��� # # @param self # # @return �ݡ��ȥꥹ�� # # @else # # @brief [RTObject CORBA interface] Get Ports # # This operation returns a list of the RTCs ports. # # @return PortList # # @endif # virtual PortServiceList* get_ports() def get_ports(self): self._rtcout.RTC_TRACE("get_ports()") try: return self._portAdmin.getPortServiceList() except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) assert(False) return [] # RTC::ComponentAction ## # @if jp # @brief [CORBA interface] ExecutionContext��attach���� # # ���ꤷ�� ExecutionContext �ˤ��� RTC ���°�����롣���� RTC �ȴ�Ϣ���� # ExecutionContext �Υϥ�ɥ���֤��� # ���Υ��ڥ졼�����ϡ�ExecutionContextOperations::add_component ���ƤФ줿 # �ݤ˸ƤӽФ���롣�֤��줿�ϥ�ɥ��¾�Υ��饤����Ȥǻ��Ѥ��뤳�Ȥ����� # ���Ƥ��ʤ��� # # @param self # @param exec_context ��°�� ExecutionContext # # @return ExecutionContext �ϥ�ɥ� # # @else # @brief [CORBA interface] Attach ExecutionContext. # # Inform this RTC that it is participating in the given execution context. # Return a handle that represents the association of this RTC with the # context. # This operation is intended to be invoked by # ExecutionContextOperations::add_component. It is not intended for use by # other clients. # # @param exec_context Prticipating ExecutionContext # # @return ExecutionContext Handle # # @endif # UniqueId attach_context(ExecutionContext_ptr exec_context) def attach_context(self, exec_context): global ECOTHER_OFFSET self._rtcout.RTC_TRACE("attach_context()") # ID: 0 - (offset-1) : owned ec # ID: offset - : participating ec # owned ec index = ID # participate ec index = ID - offset ecs = exec_context._narrow(RTC.ExecutionContextService) if CORBA.is_nil(ecs): return -1 # if m_ecOther has nil element, insert attached ec to there. for i in range(len(self._ecOther)): if CORBA.is_nil(self._ecOther[i]): self._ecOther[i] = ecs ec_id = i + ECOTHER_OFFSET self.onAttachExecutionContext(ec_id) return ec_id # no space in the list, push back ec to the last. OpenRTM_aist.CORBA_SeqUtil.push_back(self._ecOther,ecs) ec_id = long(len(self._ecOther) - 1 + ECOTHER_OFFSET) self.onAttachExecutionContext(ec_id) return ec_id # UniqueId bindContext(ExecutionContext_ptr exec_context); def bindContext(self, exec_context): global ECOTHER_OFFSET self._rtcout.RTC_TRACE("bindContext()") # ID: 0 - (offset-1) : owned ec # ID: offset - : participating ec # owned ec index = ID # participate ec index = ID - offset ecs = exec_context._narrow(RTC.ExecutionContextService) if CORBA.is_nil(ecs): return -1 # if m_ecMine has nil element, insert attached ec to there. for i in range(len(self._ecMine)): if CORBA.is_nil(self._ecMine[i]): self._ecMine[i] = ecs self.onAttachExecutionContext(i) return i #return i + ECOTHER_OFFSET # no space in the list, push back ec to the last. OpenRTM_aist.CORBA_SeqUtil.push_back(self._ecMine,ecs) return long(len(self._ecMine) - 1) #return long(len(self._ecMine) - 1 + ECOTHER_OFFSET) ## # @if jp # @brief [CORBA interface] ExecutionContext��detach���� # # ���ꤷ�� ExecutionContext ���餳�� RTC �ν�°�������롣 # ���Υ��ڥ졼�����ϡ�ExecutionContextOperations::remove_component ���Ƥ� # �줿�ݤ˸ƤӽФ���롣�֤��줿�ϥ�ɥ��¾�Υ��饤����Ȥǻ��Ѥ��뤳�Ȥ� # ���ꤷ�Ƥ��ʤ��� # # ���� # - ���ꤵ�줿 ExecutionContext �� RTC �����Ǥ˽�°���Ƥ��ʤ����ˤϡ� # ReturnCode_t::PRECONDITION_NOT_MET ���֤���롣 # - ���ꤵ�줿 ExecutionContext �ˤ��������Ф��� RTC ��Active ���֤Ǥ���� # ��ˤϡ� ReturnCode_t::PRECONDITION_NOT_MET ���֤���롣 # # @param self # @param ec_id ����о� ExecutionContext�ϥ�ɥ� # # @return ReturnCode_t ���Υ꥿���󥳡��� # # @else # @brief [CORBA interface] Attach ExecutionContext. # # Inform this RTC that it is no longer participating in the given execution # context. # This operation is intended to be invoked by # ExecutionContextOperations::remove_component. It is not intended for use # by other clients. # Constraints # - This operation may not be invoked if this RTC is not already # participating in the execution context. Such a call shall fail with # ReturnCode_t::PRECONDITION_NOT_MET. # - This operation may not be invoked if this RTC is Active in the indicated # execution context. Otherwise, it shall fail with # ReturnCode_t::PRECONDITION_NOT_MET. # # @param ec_id Dettaching ExecutionContext Handle # # @return # # @endif # ReturnCode_t detach_context(UniqueId exec_handle) def detach_context(self, ec_id): global ECOTHER_OFFSET self._rtcout.RTC_TRACE("detach_context(%d)", ec_id) len_ = len(self._ecOther) # ID: 0 - (offset-1) : owned ec # ID: offset - : participating ec # owned ec index = ID # participate ec index = ID - offset if (long(ec_id) < long(ECOTHER_OFFSET)) or \ (long(ec_id - ECOTHER_OFFSET) > len_): return RTC.BAD_PARAMETER index = long(ec_id - ECOTHER_OFFSET) if index < 0 or CORBA.is_nil(self._ecOther[index]): return RTC.BAD_PARAMETER #OpenRTM_aist.CORBA_SeqUtil.erase(self._ecOther, index) self._ecOther[index] = RTC.ExecutionContextService._nil self.onDetachExecutionContext(ec_id) return RTC.RTC_OK ## # @if jp # # @brief [ComponentAction CORBA interface] RTC �ν���� # # RTC ����������졢Alive ���֤����ܤ��롣 # RTC ��ͭ�ν���������Ϥ����Ǽ¹Ԥ��롣 # ���Υ��ڥ졼�����ƤӽФ��η�̤Ȥ��� onInitialize() ������Хå��ؿ��� # �ƤӽФ���롣 # # @param self # # @return ReturnCode_t ���Υ꥿���󥳡��� # # @else # # @brief [ComponentAction CORBA interface] Initialize RTC # # The RTC has been initialized and entered the Alive state. # Any RTC-specific initialization logic should be performed here. # # @return # # @endif def on_initialize(self): self._rtcout.RTC_TRACE("on_initialize()") ret = RTC.RTC_ERROR try: self.preOnInitialize(0) ret = self.onInitialize() except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) ret = RTC.RTC_ERROR active_set = self._properties.getProperty("configuration.active_config", "default") if self._configsets.haveConfig(active_set): self._configsets.update(active_set) else: self._configsets.update("default") self.postOnInitialize(0,ret) return ret ## # @if jp # # @brief [ComponentAction CORBA interface] RTC �ν�λ # # RTC ���˴�����롣 # RTC ��ͭ�ν�λ�����Ϥ����Ǽ¹Ԥ��롣 # ���Υ��ڥ졼�����ƤӽФ��η�̤Ȥ��� onFinalize() ������Хå��ؿ��� # �ƤӽФ���롣 # # @param self # # @return ReturnCode_t ���Υ꥿���󥳡��� # # @else # # @brief [ComponentAction CORBA interface] Finalize RTC # # The RTC is being destroyed. # Any final RTC-specific tear-down logic should be performed here. # # @return # # @endif def on_finalize(self): self._rtcout.RTC_TRACE("on_finalize()") ret = RTC.RTC_ERROR try: self.preOnFinalize(0) ret = self.onFinalize() except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) ret = RTC.RTC_ERROR self.postOnFinalize(0, ret) return ret ## # @if jp # # @brief [ComponentAction CORBA interface] RTC �γ��� # # RTC ����°���� ExecutionContext �� Stopped ���֤��� Running ���֤����� # �������˸ƤӽФ���롣 # ���Υ��ڥ졼�����ƤӽФ��η�̤Ȥ��� onStartup() ������Хå��ؿ��� # �ƤӽФ���롣 # # @param self # @param ec_id �������ܤ��� ExecutionContext �� ID # # @return ReturnCode_t ���Υ꥿���󥳡��� # # @else # # @brief [ComponentAction CORBA interface] StartUp RTC # # The given execution context, in which the RTC is participating, has # transitioned from Stopped to Running. # # @param ec_id # # @return # # @endif def on_startup(self, ec_id): self._rtcout.RTC_TRACE("on_startup(%d)", ec_id) ret = RTC.RTC_ERROR try: self.preOnStartup(ec_id) ret = self.onStartup(ec_id) except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) ret = RTC.RTC_ERROR self.postOnStartup(ec_id, ret) return ret ## # @if jp # # @brief [ComponentAction CORBA interface] RTC ����� # # RTC ����°���� ExecutionContext �� Running ���֤��� Stopped ���֤����� # �������˸ƤӽФ���롣 # ���Υ��ڥ졼�����ƤӽФ��η�̤Ȥ��� onShutdown() ������Хå��ؿ��� # �ƤӽФ���롣 # # @param self # @param ec_id �������ܤ��� ExecutionContext �� ID # # @return ReturnCode_t ���Υ꥿���󥳡��� # # @else # # @brief [ComponentAction CORBA interface] ShutDown RTC # # The given execution context, in which the RTC is participating, has # transitioned from Running to Stopped. # # @param ec_id # # @return # # @endif def on_shutdown(self, ec_id): self._rtcout.RTC_TRACE("on_shutdown(%d)", ec_id) ret = RTC.RTC_ERROR try: self.preOnShutdown(ec_id) ret = self.onShutdown(ec_id) except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) ret = RTC.RTC_ERROR self.postOnShutdown(ec_id, ret) return ret ## # @if jp # # @brief [ComponentAction CORBA interface] RTC �γ����� # # ��°���� ExecutionContext ���� RTC �����������줿�ݤ˸ƤӽФ���롣 # ���Υ��ڥ졼�����ƤӽФ��η�̤Ȥ��� onActivated() ������Хå��ؿ��� # �ƤӽФ���롣 # # @param self # @param ec_id ������ ExecutionContext �� ID # # @return ReturnCode_t ���Υ꥿���󥳡��� # # @else # # @brief [ComponentAction CORBA interface] Activate RTC # # The RTC has been activated in the given execution context. # # @param ec_id # # @return # # @endif def on_activated(self, ec_id): self._rtcout.RTC_TRACE("on_activated(%d)", ec_id) ret = RTC.RTC_ERROR try: self.preOnActivated(ec_id) self._configsets.update() ret = self.onActivated(ec_id) self._portAdmin.activatePorts() except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) ret = RTC.RTC_ERROR self.postOnActivated(ec_id, ret) return ret ## # @if jp # # @brief [ComponentAction CORBA interface] RTC ��������� # # ��°���� ExecutionContext ���� RTC ������������줿�ݤ˸ƤӽФ���롣 # ���Υ��ڥ졼�����ƤӽФ��η�̤Ȥ��� onDeactivated() ������Хå��ؿ��� # �ƤӽФ���롣 # # @param self # @param ec_id ������� ExecutionContext �� ID # # @return ReturnCode_t ���Υ꥿���󥳡��� # # @else # # @brief [ComponentAction CORBA interface] Deactivate RTC # # The RTC has been deactivated in the given execution context. # # @param ec_id # # @return # # @endif def on_deactivated(self, ec_id): self._rtcout.RTC_TRACE("on_deactivated(%d)", ec_id) ret = RTC.RTC_ERROR try: self.preOnDeactivated(ec_id) self._portAdmin.deactivatePorts() ret = self.onDeactivated(ec_id) except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) ret = RTC.RTC_ERROR self.postOnDeactivated(ec_id, ret) return ret ## # @if jp # # @brief [ComponentAction CORBA interface] RTC �Υ��顼���֤ؤ����� # # RTC ����°���� ExecutionContext �� Active ���֤��� Error ���֤����ܤ��� # ���˸ƤӽФ���롣 # ���Υ��ڥ졼������ RTC �� Error ���֤����ܤ����ݤ˰��٤����ƤӽФ���롣 # ���Υ��ڥ졼�����ƤӽФ��η�̤Ȥ��� onAborting() ������Хå��ؿ��� # �ƤӽФ���롣 # # @param self # @param ec_id �������ܤ��� ExecutionContext �� ID # # @return ReturnCode_t ���Υ꥿���󥳡��� # # @else # # @brief [ComponentAction CORBA interface] Transition Error State # # The RTC is transitioning from the Active state to the Error state in some # execution context. # This callback is invoked only a single time for time that the RTC # transitions into the Error state from another state. This behavior is in # contrast to that of on_error. # # @param ec_id # # @return # # @endif def on_aborting(self, ec_id): self._rtcout.RTC_TRACE("on_aborting(%d)", ec_id) ret = RTC.RTC_ERROR try: self.preOnAborting(ec_id) ret = self.onAborting(ec_id) except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) ret = RTC.RTC_ERROR self.postOnAborting(ec_id, ret) return ret ## # @if jp # # @brief [ComponentAction CORBA interface] RTC �Υ��顼���� # # RTC �����顼���֤ˤ���ݤ˸ƤӽФ���롣 # RTC �����顼���֤ξ��ˡ��оݤȤʤ� ExecutionContext ��ExecutionKind �� # �����������ߥ󥰤ǸƤӽФ���롣�㤨�С� # - ExecutionKind �� PERIODIC �ξ�硢�ܥ��ڥ졼������ # DataFlowComponentAction::on_execute �� on_state_update ���ؤ��ˡ� # ���ꤵ�줿���֡����ꤵ�줿�����ǸƤӽФ���롣 # - ExecutionKind �� EVENT_DRIVEN �ξ�硢�ܥ��ڥ졼������ # FsmParticipantAction::on_action ���ƤФ줿�ݤˡ��ؤ��˸ƤӽФ���롣 # ���Υ��ڥ졼�����ƤӽФ��η�̤Ȥ��� onError() ������Хå��ؿ����Ƥӽ� # ����롣 # # @param self # @param ec_id �о� ExecutionContext �� ID # # @return ReturnCode_t ���Υ꥿���󥳡��� # # @else # # @brief [ComponentAction CORBA interface] Error Processing of RTC # # The RTC remains in the Error state. # If the RTC is in the Error state relative to some execution context when # it would otherwise be invoked from that context (according to the # context��s ExecutionKind), this callback shall be invoked instead. # For example, # - If the ExecutionKind is PERIODIC, this operation shall be invoked in # sorted order at the rate of the context instead of # DataFlowComponentAction::on_execute and on_state_update. # - If the ExecutionKind is EVENT_DRIVEN, this operation shall be invoked # whenever FsmParticipantAction::on_action would otherwise have been # invoked. # # @param ec_id # # @return # # @endif def on_error(self, ec_id): self._rtcout.RTC_TRACE("on_error(%d)", ec_id) ret = RTC.RTC_ERROR try: self.preOnError(ec_id) ret = self.onError(ec_id) except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) ret = RTC.RTC_ERROR self._configsets.update() self.postOnError(ec_id, ret) return ret ## # @if jp # # @brief [ComponentAction CORBA interface] RTC �Υꥻ�å� # # Error ���֤ˤ��� RTC �Υꥫ�Х������¹Ԥ���Inactive ���֤����������� # ���˸ƤӽФ���롣 # RTC �Υꥫ�Х������������������ Inactive ���֤��������뤬������ʳ��� # ���ˤ� Error ���֤�α�ޤ롣 # ���Υ��ڥ졼�����ƤӽФ��η�̤Ȥ��� onReset() ������Хå��ؿ����Ƥ� # �Ф���롣 # # @param self # @param ec_id �ꥻ�å��о� ExecutionContext �� ID # # @return ReturnCode_t ���Υ꥿���󥳡��� # # @else # # @brief [ComponentAction CORBA interface] Resetting RTC # # The RTC is in the Error state. An attempt is being made to recover it such # that it can return to the Inactive state. # If the RTC was successfully recovered and can safely return to the # Inactive state, this method shall complete with ReturnCode_t::OK. Any # other result shall indicate that the RTC should remain in the Error state. # # @param ec_id # # @return # # @endif def on_reset(self, ec_id): self._rtcout.RTC_TRACE("on_reset(%d)", ec_id) ret = RTC.RTC_ERROR try: self.preOnReset(ec_id) ret = self.onReset(ec_id) except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) ret = RTC.RTC_ERROR self.postOnReset(ec_id, ret) return ret ## # @if jp # # @brief [DataFlowComponentAction CORBA interface] RTC ��������(������) # # �ʲ��ξ��֤��ݻ�����Ƥ�����ˡ����ꤵ�줿���������Ū�˸ƤӽФ���롣 # - RTC �� Alive ���֤Ǥ��롣 # - ���ꤵ�줿 ExecutionContext �� Running ���֤Ǥ��롣 # �ܥ��ڥ졼�����ϡ�Two-Pass Execution ���������Ǽ¹Ԥ���롣 # ���Υ��ڥ졼�����ƤӽФ��η�̤Ȥ��� onExecute() ������Хå��ؿ����Ƥ� # �Ф���롣 # # ���� # - ���ꤵ�줿 ExecutionContext �� ExecutionKind �ϡ� PERIODIC �Ǥʤ���Ф� # ��ʤ� # # @param self # @param ec_id �������о� ExecutionContext �� ID # # @return ReturnCode_t ���Υ꥿���󥳡��� # # @else # # @brief [DataFlowComponentAction CORBA interface] Primary Periodic # Operation of RTC # # This operation will be invoked periodically at the rate of the given # execution context as long as the following conditions hold: # - The RTC is Active. # - The given execution context is Running # This callback occurs during the first execution pass. # # Constraints # - The execution context of the given context shall be PERIODIC. # # @param ec_id # # @return # # @endif def on_execute(self, ec_id): self._rtcout.RTC_TRACE("on_execute(%d)", ec_id) ret = RTC.RTC_ERROR try: self.preOnExecute(ec_id) if self._readAll: self.readAll() ret = self.onExecute(ec_id) if self._writeAll: self.writeAll() except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) ret = RTC.RTC_ERROR self.postOnExecute(ec_id, ret) return ret ## # @if jp # # @brief [DataFlowComponentAction CORBA interface] RTC ��������(�������) # # �ʲ��ξ��֤��ݻ�����Ƥ�����ˡ����ꤵ�줿���������Ū�˸ƤӽФ���롣 # - RTC �� Alive ���֤Ǥ��롣 # - ���ꤵ�줿 ExecutionContext �� Running ���֤Ǥ��롣 # �ܥ��ڥ졼�����ϡ�Two-Pass Execution ����������Ǽ¹Ԥ���롣 # ���Υ��ڥ졼�����ƤӽФ��η�̤Ȥ��� onStateUpdate() ������Хå��ؿ��� # �ƤӽФ���롣 # # ���� # - ���ꤵ�줿 ExecutionContext �� ExecutionKind �ϡ� PERIODIC �Ǥʤ���Ф� # ��ʤ� # # @param self # @param ec_id �������о� ExecutionContext �� ID # # @return ReturnCode_t ���Υ꥿���󥳡��� # # @else # # @brief [DataFlowComponentAction CORBA interface] Secondary Periodic # Operation of RTC # # This operation will be invoked periodically at the rate of the given # execution context as long as the following conditions hold: # - The RTC is Active. # - The given execution context is Running # This callback occurs during the second execution pass. # # Constraints # - The execution context of the given context shall be PERIODIC. # # @param ec_id # # @return # # @endif def on_state_update(self, ec_id): self._rtcout.RTC_TRACE("on_state_update(%d)", ec_id) ret = RTC.RTC_ERROR try: self.preOnStateUpdate(ec_id) ret = self.onStateUpdate(ec_id) self._configsets.update() except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) ret = RTC.RTC_ERROR self.postOnStateUpdate(ec_id, ret) return ret ## # @if jp # # @brief [DataFlowComponentAction CORBA interface] �¹Լ����ѹ����� # # �ܥ��ڥ졼�����ϡ�ExecutionContext �μ¹Լ������ѹ����줿���Ȥ����Τ��� # �ݤ˸ƤӽФ���롣 # ���Υ��ڥ졼�����ƤӽФ��η�̤Ȥ��� onRateChanged() ������Хå��ؿ��� # �ƤӽФ���롣 # # ���� # - ���ꤵ�줿 ExecutionContext �� ExecutionKind �ϡ� PERIODIC �Ǥʤ���Ф� # ��ʤ� # # @param self # @param ec_id �������о� ExecutionContext �� ID # # @return ReturnCode_t ���Υ꥿���󥳡��� # # @else # # @brief [DataFlowComponentAction CORBA interface] Notify rate chenged # # This operation is a notification that the rate of the indicated execution # context has changed. # # Constraints # - The execution context of the given context shall be PERIODIC. # # @param ec_id # # @return # # @endif def on_rate_changed(self, ec_id): self._rtcout.RTC_TRACE("on_rate_changed(%d)", ec_id) ret = RTC.RTC_ERROR try: self.preOnRateChanged(ec_id) ret = self.onRateChanged(ec_id) except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) ret = RTC.RTC_ERROR self.postOnRateChanged(ec_id, ret) return ret #============================================================ # SDOPackage::SdoSystemElement #============================================================ ## # @if jp # # @brief [SDO interface] Organization �ꥹ�Ȥμ��� # # SDOSystemElement ��0�Ĥ⤷���Ϥ���ʾ�� Organization ���ͭ���뤳�Ȥ� # ����롣 SDOSystemElement ��1�İʾ�� Organization ���ͭ���Ƥ����� # �ˤϡ����Υ��ڥ졼�����Ͻ�ͭ���� Organization �Υꥹ�Ȥ��֤��� # �⤷Organization���Ĥ��ͭ���Ƥ��ʤ�����ж��Υꥹ�Ȥ��֤��� # # @param self # # @return ��ͭ���Ƥ��� Organization �ꥹ�� # # @exception SDONotExists �������åȤ�SDO��¸�ߤ��ʤ���(���㳰�ϡ�CORBAɸ�� # �����ƥ��㳰��OBJECT_NOT_EXIST�˥ޥåԥ󥰤����) # @exception NotAvailable SDO��¸�ߤ��뤬�������ʤ��� # @exception InternalError ����Ū���顼��ȯ�������� # # @else # # @brief [SDO interface] Getting Organizations # # SDOSystemElement can be the owner of zero or more organizations. # If the SDOSystemElement owns one or more Organizations, this operation # returns the list of Organizations that the SDOSystemElement owns. # If it does not own any Organization, it returns empty list. # # @return Owned Organization List # # @exception SDONotExists if the target SDO does not exist.(This exception # is mapped to CORBA standard system exception # OBJECT_NOT_EXIST.) # @exception NotAvailable if the target SDO is reachable but cannot # respond. # @exception InternalError if the target SDO cannot execute the operation # completely due to some internal error. # # @endif # virtual SDOPackage::OrganizationList* get_owned_organizations() def get_owned_organizations(self): self._rtcout.RTC_TRACE("get_owned_organizations()") try: return self._sdoOwnedOrganizations except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) raise SDOPackage.NotAvailable("NotAvailable: get_owned_organizations") return [] #============================================================ # SDOPackage::SDO #============================================================ ## # @if jp # # @brief [SDO interface] SDO ID �μ��� # # SDO ID ���֤����ڥ졼����� # ���Υ��ڥ졼�����ϰʲ��η����㳰��ȯ�������롣 # # @param self # # @return �꥽�����ǡ�����ǥ���������Ƥ��� SDO �� ID # # @exception SDONotExists �������åȤ�SDO��¸�ߤ��ʤ���(���㳰�ϡ�CORBAɸ�� # �����ƥ��㳰��OBJECT_NOT_EXIST�˥ޥåԥ󥰤����) # @exception NotAvailable SDO��¸�ߤ��뤬�������ʤ��� # @exception InternalError ����Ū���顼��ȯ�������� # # @else # # @brief [SDO interface] Getting SDO ID # # This operation returns id of the SDO. # This operation throws SDOException with one of the following types. # # @return id of the SDO defined in the resource data model. # # @exception SDONotExists if the target SDO does not exist.(This exception # is mapped to CORBA standard system exception # OBJECT_NOT_EXIST.) # @exception NotAvailable if the target SDO is reachable but cannot # respond. # @exception InternalError if the target SDO cannot execute the operation # completely due to some internal error. # # @endif # virtual char* get_sdo_id() def get_sdo_id(self): self._rtcout.RTC_TRACE("get_sdo_id()") try: return self._profile.instance_name except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) raise SDOPackage.InternalError("get_sdo_id()") ## # @if jp # # @brief [SDO interface] SDO �����פμ��� # # SDO Type ���֤����ڥ졼����� # ���Υ��ڥ졼�����ϰʲ��η����㳰��ȯ�������롣 # # @param self # # @return �꥽�����ǡ�����ǥ���������Ƥ��� SDO �� Type # # @exception SDONotExists �������åȤ�SDO��¸�ߤ��ʤ���(���㳰�ϡ�CORBAɸ�� # �����ƥ��㳰��OBJECT_NOT_EXIST�˥ޥåԥ󥰤����) # @exception NotAvailable SDO��¸�ߤ��뤬�������ʤ��� # @exception InternalError ����Ū���顼��ȯ�������� # # @else # # @brief [SDO interface] Getting SDO type # # This operation returns sdoType of the SDO. # This operation throws SDOException with one of the following types. # # @return Type of the SDO defined in the resource data model. # # @exception SDONotExists if the target SDO does not exist.(This exception # is mapped to CORBA standard system exception # OBJECT_NOT_EXIST.) # @exception NotAvailable if the target SDO is reachable but cannot # respond. # @exception InternalError if the target SDO cannot execute the operation # completely due to some internal error. # # @endif # virtual char* get_sdo_type() def get_sdo_type(self): self._rtcout.RTC_TRACE("get_sdo_type()") try: return self._profile.description except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) raise SDOPackage.InternalError("get_sdo_type()") return "" ## # @if jp # # @brief [SDO interface] SDO DeviceProfile �ꥹ�Ȥμ��� # # SDO �� DeviceProfile ���֤����ڥ졼����� SDO ���ϡ��ɥ������ǥХ��� # �˴�Ϣ�դ����Ƥ��ʤ����ˤϡ����� DeviceProfile ���֤���롣 # ���Υ��ڥ졼�����ϰʲ��η����㳰��ȯ�������롣 # # @param self # # @return SDO DeviceProfile # # @exception SDONotExists �������åȤ�SDO��¸�ߤ��ʤ���(���㳰�ϡ�CORBAɸ�� # �����ƥ��㳰��OBJECT_NOT_EXIST�˥ޥåԥ󥰤����) # @exception NotAvailable SDO��¸�ߤ��뤬�������ʤ��� # @exception InternalError ����Ū���顼��ȯ�������� # # @else # # @brief [SDO interface] Getting SDO DeviceProfile # # This operation returns the DeviceProfile of the SDO. If the SDO does not # represent any hardware device, then a DeviceProfile with empty values # are returned. # This operation throws SDOException with one of the following types. # # @return The DeviceProfile of the SDO. # # @exception SDONotExists if the target SDO does not exist.(This exception # is mapped to CORBA standard system exception # OBJECT_NOT_EXIST.) # @exception NotAvailable if the target SDO is reachable but cannot # respond. # @exception InternalError if the target SDO cannot execute the operation # completely due to some internal error. # # @endif # virtual SDOPackage::DeviceProfile* get_device_profile() def get_device_profile(self): self._rtcout.RTC_TRACE("get_device_profile()") try: return self._SdoConfigImpl.getDeviceProfile() except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) raise SDOPackage.InternalError("get_device_profile()") return SDOPackage.DeviceProfile("","","","",[]) ## # @if jp # # @brief [SDO interface] SDO ServiceProfile �μ��� # # SDO ����ͭ���Ƥ��� Service �� ServiceProfile ���֤����ڥ졼����� # SDO �������ӥ����Ĥ��ͭ���Ƥ��ʤ����ˤϡ����Υꥹ�Ȥ��֤��� # ���Υ��ڥ졼�����ϰʲ��η����㳰��ȯ�������롣 # # @param self # # @return SDO ���󶡤������Ƥ� Service �� ServiceProfile�� # # @exception SDONotExists �������åȤ�SDO��¸�ߤ��ʤ���(���㳰�ϡ�CORBAɸ�� # �����ƥ��㳰��OBJECT_NOT_EXIST�˥ޥåԥ󥰤����) # @exception NotAvailable SDO��¸�ߤ��뤬�������ʤ��� # @exception InternalError ����Ū���顼��ȯ�������� # # @else # # @brief [SDO interface] Getting SDO ServiceProfile # # This operation returns a list of ServiceProfiles that the SDO has. # If the SDO does not provide any service, then an empty list is returned. # This operation throws SDOException with one of the following types. # # @return List of ServiceProfiles of all the services the SDO is # providing. # # @exception SDONotExists if the target SDO does not exist.(This exception # is mapped to CORBA standard system exception # OBJECT_NOT_EXIST.) # @exception NotAvailable if the target SDO is reachable but cannot # respond. # @exception InternalError if the target SDO cannot execute the operation # completely due to some internal error. # # @endif # virtual SDOPackage::ServiceProfileList* get_service_profiles() def get_service_profiles(self): self._rtcout.RTC_TRACE("get_service_profiles()") self._sdoSvcProfiles = self._SdoConfigImpl.getServiceProfiles() try: return self._sdoSvcProfiles except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) raise SDOPackage.InternalError("get_service_profiles()") return [] ## # @if jp # # @brief [SDO interface] �����ServiceProfile�μ��� # # ���� "id" �ǻ��ꤵ�줿̾���Υ����ӥ��� ServiceProfile ���֤��� # # @param self # @param _id SDO Service �� ServiceProfile �˴�Ϣ�դ���줿���̻ҡ� # # @return ���ꤵ�줿 SDO Service �� ServiceProfile�� # # @exception InvalidParameter "id" �ǻ��ꤷ�� ServiceProfile ��¸�ߤ��ʤ��� # "id" �� null�� # @exception SDONotExists �������åȤ�SDO��¸�ߤ��ʤ���(���㳰�ϡ�CORBAɸ�� # �����ƥ��㳰��OBJECT_NOT_EXIST�˥ޥåԥ󥰤����) # @exception NotAvailable SDO��¸�ߤ��뤬�������ʤ��� # @exception InternalError ����Ū���顼��ȯ�������� # # @else # # @brief [SDO interface] Getting Organizations # # This operation returns the ServiceProfile that is specified by the # argument "id." # # @param _id The identifier referring to one of the ServiceProfiles. # # @return The profile of the specified service. # # @exception InvalidParameter if the ServiceProfile that is specified by # the argument 'id' does not exist or if 'id' # is 'null.' # @exception SDONotExists if the target SDO does not exist.(This exception # is mapped to CORBA standard system exception # OBJECT_NOT_EXIST.) # @exception NotAvailable If the target SDO is reachable but cannot # respond. # @exception InternalError If the target SDO cannot execute the operation # completely due to some internal error. # # @endif # virtual SDOPackage::ServiceProfile* get_service_profile(const char* id) def get_service_profile(self, _id): self._rtcout.RTC_TRACE("get_service_profile(%s)", _id) self._sdoSvcProfiles = self._SdoConfigImpl.getServiceProfiles() if not _id: raise SDOPackage.InvalidParameter("get_service_profile(): Empty name.") try: index = OpenRTM_aist.CORBA_SeqUtil.find(self._sdoSvcProfiles, self.svc_name(_id)) if index < 0: raise SDOPackage.InvalidParameter("get_service_profile(): Not found") return self._sdoSvcProfiles[index] except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) raise SDOPackage.InternalError("get_service_profile()") return SDOPackage.ServiceProfile("", "", [], None) ## # @if jp # # @brief [SDO interface] ���ꤵ�줿 SDO Service �μ��� # # ���Υ��ڥ졼�����ϰ��� "id" �ǻ��ꤵ�줿̾���ˤ�äƶ��̤���� # SDO �� Service �ؤΥ��֥������Ȼ��Ȥ��֤��� SDO �ˤ���󶡤���� # Service �Ϥ��줾���դμ��̻Ҥˤ����̤���롣 # # @param self # @param _id SDO Service �˴�Ϣ�դ���줿���̻ҡ� # # @return �׵ᤵ�줿 SDO Service �ؤλ��ȡ� # # # @exception InvalidParameter "id" �ǻ��ꤷ�� ServiceProfile ��¸�ߤ��ʤ��� # "id" �� null�� # @exception SDONotExists �������åȤ�SDO��¸�ߤ��ʤ���(���㳰�ϡ�CORBAɸ�� # �����ƥ��㳰��OBJECT_NOT_EXIST�˥ޥåԥ󥰤����) # @exception NotAvailable SDO��¸�ߤ��뤬�������ʤ��� # @exception InternalError ����Ū���顼��ȯ�������� # # @else # # @brief [SDO interface] Getting specified SDO Service's reference # # This operation returns an object implementing an SDO's service that # is identified by the identifier specified as an argument. Different # services provided by an SDO are distinguished with different # identifiers. See OMG SDO specification Section 2.2.8, "ServiceProfile," # on page 2-12 for more details. # # @param _id The identifier referring to one of the SDO Service # @return The object implementing the requested service. # @exception InvalidParameter if argument ��id�� is null, or if the # ServiceProfile that is specified by argument # ��id�� does not exist. # @exception SDONotExists if the target SDO does not exist.(This exception # is mapped to CORBA standard system exception # OBJECT_NOT_EXIST.) # @exception NotAvailable If the target SDO is reachable but cannot # respond. # @exception InternalError If the target SDO cannot execute the operation # completely due to some internal error. # # @endif # virtual SDOPackage::SDOService_ptr get_sdo_service(const char* id) def get_sdo_service(self, _id): self._rtcout.RTC_TRACE("get_sdo_service(%s)", _id) self._sdoSvcProfiles = self._SdoConfigImpl.getServiceProfiles() if not _id: raise SDOPackage.InvalidParameter("get_service(): Empty name.") index = OpenRTM_aist.CORBA_SeqUtil.find(self._sdoSvcProfiles, self.svc_name(_id)) if index < 0: raise SDOPackage.InvalidParameter("get_service(): Not found") try: return self._sdoSvcProfiles[index].service except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) raise SDOPackage.InternalError("get_service()") return SDOPackage.SDOService._nil ## # @if jp # # @brief [SDO interface] Configuration ���֥������Ȥμ��� # # ���Υ��ڥ졼������ Configuration interface �ؤλ��Ȥ��֤��� # Configuration interface �ϳ� SDO ��������뤿��Υ��󥿡��ե������� # �ҤȤĤǤ��롣���Υ��󥿡��ե������� DeviceProfile, ServiceProfile, # Organization ��������줿 SDO ��°���ͤ����ꤹ�뤿��˻��Ѥ���롣 # Configuration ���󥿡��ե������ξܺ٤ˤĤ��Ƥϡ�OMG SDO specification # �� 2.3.5��, p.2-24 �򻲾ȤΤ��ȡ� # # @param self # # @return SDO �� Configuration ���󥿡��ե������ؤλ��� # # @exception InterfaceNotImplemented SDO��Configuration���󥿡��ե������� # �����ʤ��� # @exception SDONotExists �������åȤ�SDO��¸�ߤ��ʤ���(���㳰�ϡ�CORBAɸ�� # �����ƥ��㳰��OBJECT_NOT_EXIST�˥ޥåԥ󥰤����) # @exception NotAvailable SDO��¸�ߤ��뤬�������ʤ��� # @exception InternalError ����Ū���顼��ȯ�������� # # @else # # @brief [SDO interface] Getting Configuration object # # This operation returns an object implementing the Configuration # interface. The Configuration interface is one of the interfaces that # each SDO maintains. The interface is used to configure the attributes # defined in DeviceProfile, ServiceProfile, and Organization. # See OMG SDO specification Section 2.3.5, "Configuration Interface," # on page 2-24 for more details about the Configuration interface. # # @return The Configuration interface of an SDO. # # @exception InterfaceNotImplemented The target SDO has no Configuration # interface. # @exception SDONotExists if the target SDO does not exist.(This exception # is mapped to CORBA standard system exception # OBJECT_NOT_EXIST.) # @exception NotAvailable The target SDO is reachable but cannot respond. # @exception InternalError The target SDO cannot execute the operation # completely due to some internal error. # @endif # virtual SDOPackage::Configuration_ptr get_configuration() def get_configuration(self): self._rtcout.RTC_TRACE("get_configuration()") if self._SdoConfig is None: raise SODPackage.InterfaceNotImplemented("InterfaceNotImplemented: get_configuration") try: return self._SdoConfig except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) raise SDOPackage.InternalError("get_configuration()") return SDOPackage.Configuration._nil ## # @if jp # # @brief [SDO interface] Monitoring ���֥������Ȥμ��� # # ���Υ��ڥ졼������ Monitoring interface �ؤλ��Ȥ��֤��� # Monitoring interface �� SDO ���������륤�󥿡��ե������ΰ�ĤǤ��롣 # ���Υ��󥿡��ե������� SDO �Υץ��ѥƥ����˥���󥰤��뤿��� # ���Ѥ���롣 # Monitoring interface �ξܺ٤ˤĤ��Ƥ� OMG SDO specification �� # 2.3.7�� "Monitoring Interface" p.2-35 �򻲾ȤΤ��ȡ� # # @param self # # @return SDO �� Monitoring interface �ؤλ��� # # @exception InterfaceNotImplemented SDO��Configuration���󥿡��ե������� # �����ʤ��� # @exception SDONotExists �������åȤ�SDO��¸�ߤ��ʤ���(���㳰�ϡ�CORBAɸ�� # �����ƥ��㳰��OBJECT_NOT_EXIST�˥ޥåԥ󥰤����) # @exception NotAvailable SDO��¸�ߤ��뤬�������ʤ��� # @exception InternalError ����Ū���顼��ȯ�������� # # @else # # @brief [SDO interface] Get Monitoring object # # This operation returns an object implementing the Monitoring interface. # The Monitoring interface is one of the interfaces that each SDO # maintains. The interface is used to monitor the properties of an SDO. # See OMG SDO specification Section 2.3.7, "Monitoring Interface," on # page 2-35 for more details about the Monitoring interface. # # @return The Monitoring interface of an SDO. # # @exception InterfaceNotImplemented The target SDO has no Configuration # interface. # @exception SDONotExists if the target SDO does not exist.(This exception # is mapped to CORBA standard system exception # OBJECT_NOT_EXIST.) # @exception NotAvailable The target SDO is reachable but cannot respond. # @exception InternalError The target SDO cannot execute the operation # completely due to some internal error. # @endif # virtual SDOPackage::Monitoring_ptr get_monitoring() def get_monitoring(self): self._rtcout.RTC_TRACE("get_monitoring()") raise SDOPackage.InterfaceNotImplemented("Exception: get_monitoring") return SDOPackage.Monitoring._nil ## # @if jp # # @brief [SDO interface] Organization �ꥹ�Ȥμ��� # # SDO ��0�İʾ�� Organization (�ȿ�)�˽�°���뤳�Ȥ��Ǥ��롣 �⤷ SDO �� # 1�İʾ�� Organization �˽�°���Ƥ����硢���Υ��ڥ졼�����Ͻ�°���� # Organization �Υꥹ�Ȥ��֤���SDO �� �ɤ� Organization �ˤ��°���Ƥ��ʤ� # ���ˤϡ����Υꥹ�Ȥ��֤���롣 # # @param self # # @return SDO ����°���� Organization �Υꥹ�ȡ� # # @exception SDONotExists �������åȤ�SDO��¸�ߤ��ʤ���(���㳰�ϡ�CORBAɸ�� # �����ƥ��㳰��OBJECT_NOT_EXIST�˥ޥåԥ󥰤����) # @exception NotAvailable SDO��¸�ߤ��뤬�������ʤ��� # @exception InternalError ����Ū���顼��ȯ�������� # @else # # @brief [SDO interface] Getting Organizations # # An SDO belongs to zero or more organizations. If the SDO belongs to one # or more organizations, this operation returns the list of organizations # that the SDO belongs to. An empty list is returned if the SDO does not # belong to any Organizations. # # @return The list of Organizations that the SDO belong to. # # @exception SDONotExists if the target SDO does not exist.(This exception # is mapped to CORBA standard system exception # OBJECT_NOT_EXIST.) # @exception NotAvailable The target SDO is reachable but cannot respond. # @exception InternalError The target SDO cannot execute the operation # completely due to some internal error. # @endif # virtual SDOPackage::OrganizationList* get_organizations() def get_organizations(self): self._rtcout.RTC_TRACE("get_organizations()") self._sdoOrganizations = self._SdoConfigImpl.getOrganizations() try: return self._sdoOrganizations except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) raise SDOPackage.InternalError("get_organizations()") return [] ## # @if jp # # @brief [SDO interface] SDO Status �ꥹ�Ȥμ��� # # ���Υ��ڥ졼������ SDO �Υ��ơ�������ɽ�� NVList ���֤��� # # @param self # # @return SDO �Υ��ơ������� # # @exception SDONotExists �������åȤ�SDO��¸�ߤ��ʤ���(���㳰�ϡ�CORBAɸ�� # �����ƥ��㳰��OBJECT_NOT_EXIST�˥ޥåԥ󥰤����) # @exception NotAvailable SDO��¸�ߤ��뤬�������ʤ��� # @exception InternalError ����Ū���顼��ȯ�������� # # @else # # @brief [SDO interface] Get SDO Status # # This operation returns an NVlist describing the status of an SDO. # # @return The actual status of an SDO. # # @exception SDONotExists if the target SDO does not exist.(This exception # is mapped to CORBA standard system exception # OBJECT_NOT_EXIST.) # @exception NotAvailable The target SDO is reachable but cannot respond. # @exception InternalError The target SDO cannot execute the operation # completely due to some internal error. # # @endif # virtual SDOPackage::NVList* get_status_list() def get_status_list(self): self._rtcout.RTC_TRACE("get_status_list()") try: return self._sdoStatus except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) raise SDOPackage.InternalError("get_status_list()") return [] ## # @if jp # # @brief [SDO interface] SDO Status �μ��� # # This operation returns the value of the specified status parameter. # # @param self # @param name SDO �Υ��ơ��������������ѥ�᡼���� # # @return ���ꤵ�줿�ѥ�᡼���Υ��ơ������͡� # # @exception SDONotExists �������åȤ�SDO��¸�ߤ��ʤ���(���㳰�ϡ�CORBAɸ�� # �����ƥ��㳰��OBJECT_NOT_EXIST�˥ޥåԥ󥰤����) # @exception NotAvailable SDO��¸�ߤ��뤬�������ʤ��� # @exception InvalidParameter ���� "name" �� null ���뤤��¸�ߤ��ʤ��� # @exception InternalError ����Ū���顼��ȯ�������� # @else # # @brief [SDO interface] Get SDO Status # # @param name One of the parameters defining the "status" of an SDO. # # @return The value of the specified status parameter. # # @exception SDONotExists if the target SDO does not exist.(This exception # is mapped to CORBA standard system exception # OBJECT_NOT_EXIST.) # @exception NotAvailable The target SDO is reachable but cannot respond. # @exception InvalidParameter The parameter defined by "name" is null or # does not exist. # @exception InternalError The target SDO cannot execute the operation # completely due to some internal error. # # # @endif # virtual CORBA::Any* get_status(const char* name) def get_status(self, name): self._rtcout.RTC_TRACE("get_status(%s)", name) index = OpenRTM_aist.CORBA_SeqUtil.find(self._sdoStatus, self.nv_name(name)) if index < 0: raise SDOPackage.InvalidParameter("get_status(): Not found") try: return any.to_any(self._sdoStatus[index].value) except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) raise SDOPackage.InternalError("get_status()") return any.to_any("") #============================================================ # Local interfaces #============================================================ ## # @if jp # # @brief [local interface] ���󥹥���̾�μ��� # # ComponentProfile �����ꤵ�줿���󥹥���̾���֤��� # # @param self # # @return ���󥹥���̾ # # @else # # @endif # const char* getInstanceName() def getInstanceName(self): self._rtcout.RTC_TRACE("getInstanceName()") return self._profile.instance_name ## # @if jp # # @brief [local interface] ���󥹥���̾������ # # ComponentProfile �˻��ꤵ�줿���󥹥���̾�����ꤹ�롣 # # @param self # # @param instance_name ���󥹥���̾ # # @else # # @endif # void setInstanceName(const char* instance_name); def setInstanceName(self, instance_name): self._rtcout.RTC_TRACE("setInstanceName(%s)", instance_name) self._properties.setProperty("instance_name",instance_name) self._profile.instance_name = self._properties.getProperty("instance_name") ## # @if jp # # @brief [local interface] ��̾�μ��� # # ComponentProfile �����ꤵ�줿��̾���֤��� # # @param self # # @return ��̾ # # @else # # @endif # const char* getTypeName() def getTypeName(self): self._rtcout.RTC_TRACE("getTypeName()") return self._profile.type_name ## # @if jp # # @brief [local interface] Description �μ��� # # ComponentProfile �����ꤵ�줿 Description ���֤��� # # @param self # # @return Description # # @else # # @endif # const char* getDescription() def getDescription(self): self._rtcout.RTC_TRACE("getDescription()") return self._profile.description ## # @if jp # # @brief [local interface] �С���������μ��� # # ComponentProfile �����ꤵ�줿�С�����������֤��� # # @param self # # @return �С��������� # # @else # # @endif # const char* getVersion() def getVersion(self): self._rtcout.RTC_TRACE("getVersion()") return self._profile.version ## # @if jp # # @brief [local interface] �٥��������μ��� # # ComponentProfile �����ꤵ�줿�٥����������֤��� # # @param self # # @return �٥�������� # # @else # # @endif # const char* getVendor() def getVendor(self): self._rtcout.RTC_TRACE("getVendor()") return self._profile.vendor ## # @if jp # # @brief [local interface] ���ƥ������μ��� # # ComponentProfile �����ꤵ�줿���ƥ��������֤��� # # @param self # # @return ���ƥ������ # # @else # # @endif # const char* getCategory() def getCategory(self): self._rtcout.RTC_TRACE("getCategory()") return self._profile.category ## # @if jp # # @brief [local interface] Naming Server ����μ��� # # ���ꤵ�줿 Naming Server ������֤��� # # @param self # # @return Naming Server �ꥹ�� # # @else # # @endif # std::vector<std::string> getNamingNames(); def getNamingNames(self): self._rtcout.RTC_TRACE("getNamingNames()") return [s.strip() for s in self._properties.getProperty("naming.names").split(",")] ## # @if jp # # @brief [local interface] ���֥������ȥ�ե���󥹤����� # # RTC �� CORBA ���֥������ȥ�ե���󥹤����ꤹ�롣 # # @param self # @param rtobj ���֥������ȥ�ե���� # # @else # # @endif # void setObjRef(const RTObject_ptr rtobj); def setObjRef(self, rtobj): self._rtcout.RTC_TRACE("setObjRef()") self._objref = rtobj return ## # @if jp # # @brief [local interface] ���֥������ȥ�ե���󥹤μ��� # # ���ꤵ�줿 CORBA ���֥������ȥ�ե���󥹤�������롣 # # @param self # # @return ���֥������ȥ�ե���� # # @else # # @endif # RTObject_ptr getObjRef() const; def getObjRef(self): self._rtcout.RTC_TRACE("getObjRef()") return self._objref ## # @if jp # # @brief [local interface] RTC �Υץ��ѥƥ������ꤹ�� # # RTC ���ݻ����٤��ץ��ѥƥ������ꤹ�롣Ϳ������ץ��ѥƥ��ϡ� # ComponentProfile �������ꤵ���٤����������ʤ���Фʤ�ʤ��� # ���Υ��ڥ졼�������̾� RTC ������������ݤ� Manager ���� # �ƤФ�뤳�Ȥ�տޤ��Ƥ��롣 # # @param self # @param prop RTC �Υץ��ѥƥ� # # @else # # @brief [local interface] Set RTC property # # This operation sets the properties to the RTC. The given property # values should include information for ComponentProfile. # Generally, this operation is designed to be called from Manager, when # RTC is initialized # # @param prop Property for RTC. # # @endif # void setProperties(const coil::Properties& prop); def setProperties(self, prop): self._rtcout.RTC_TRACE("setProperties()") self._properties.mergeProperties(prop) self._profile.instance_name = self._properties.getProperty("instance_name") self._profile.type_name = self._properties.getProperty("type_name") self._profile.description = self._properties.getProperty("description") self._profile.version = self._properties.getProperty("version") self._profile.vendor = self._properties.getProperty("vendor") self._profile.category = self._properties.getProperty("category") ## # @if jp # # @brief [local interface] RTC �Υץ��ѥƥ���������� # # RTC ���ݻ����Ƥ���ץ��ѥƥ����֤��� # RTC���ץ��ѥƥ�������ʤ����϶��Υץ��ѥƥ����֤���롣 # # @param self # # @return RTC �Υץ��ѥƥ� # # @else # # @brief [local interface] Get RTC property # # This operation returns the properties of the RTC. # Empty property would be returned, if RTC has no property. # # @return Property for RTC. # # @endif # coil::Properties& getProperties(); def getProperties(self): self._rtcout.RTC_TRACE("getProperties()") return self._properties ## # @if jp # # @brief ����ե�����졼�����ѥ�᡼�������� # # ����ե�����졼�����ѥ�᡼�����ѿ���Х���ɤ��� # <VarType>�Ȥ��ƥ���ե�����졼�����ѥ�᡼���Υǡ���������ꤹ�롣 # # @param self # @param param_name ����ե�����졼�����ѥ�᡼��̾ # @param var ����ե�����졼�����ѥ�᡼����Ǽ���ѿ� # @param def_val ����ե�����졼�����ѥ�᡼���ǥե������ # @param trans ʸ�����Ѵ��Ѵؿ�(�ǥե������:None) # # @return ������(��������:true�����꼺��:false) # # @else # # @endif # template <typename VarType> # bool bindParameter(const char* param_name, VarType& var, # const char* def_val, # bool (*trans)(VarType&, const char*) = coil::stringTo) def bindParameter(self, param_name, var, def_val, trans=None): self._rtcout.RTC_TRACE("bindParameter()") if trans is None: trans_ = OpenRTM_aist.stringTo else: trans_ = trans self._configsets.bindParameter(param_name, var, def_val, trans_) return True ## # @if jp # # @brief ����ե�����졼�����ѥ�᡼���ι���(ID����) # # ���ꤷ��ID�Υ���ե�����졼����󥻥åȤ����ꤷ���ͤǡ� # ����ե�����졼�����ѥ�᡼�����ͤ򹹿����� # # @param self # @param config_set �����оݤΥ���ե�����졼����󥻥å�ID # # @else # # @endif # void updateParameters(const char* config_set); def updateParameters(self, config_set): self._rtcout.RTC_TRACE("updateParameters(%s)", config_set) self._configsets.update(config_set) return ## # @if jp # # @brief [local interface] Port ����Ͽ���� # # RTC ���ݻ�����Port����Ͽ���롣 # Port �������饢��������ǽ�ˤ��뤿��ˤϡ����Υ��ڥ졼�����ˤ�� # ��Ͽ����Ƥ��ʤ���Фʤ�ʤ�����Ͽ����� Port �Ϥ��� RTC �����ˤ����� # PortProfile.name �ˤ����̤���롣�������äơ�Port �� RTC ��ˤ����ơ� # ��ˡ����� PortProfile.name ������ʤ���Фʤ�ʤ��� # ��Ͽ���줿 Port ��������Ŭ�ڤ˥����ƥ��ֲ����줿�塢���λ��Ȥ� # ���֥������Ȼ��Ȥ��ꥹ�������¸����롣 # # @param self # @param port RTC ����Ͽ���� Port # @param port_type if port is PortBase, port_type is None, # if port is PortService, port_type is True # # @else # # @brief [local interface] Register Port # # This operation registers a Port to be held by this RTC. # In order to enable access to the Port from outside of RTC, the Port # must be registered by this operation. The Port that is registered by # this operation would be identified by PortProfile.name in the inside of # RTC. Therefore, the Port should have unique PortProfile.name in the RTC. # The registering Port would be activated properly, and the reference # and the object reference would be stored in lists in RTC. # # @param port Port which is registered in the RTC # # @endif # void registerPort(PortBase& port); def registerPort(self, port): self._rtcout.RTC_TRACE("registerPort()") if not self.addPort(port): self._rtcout.RTC_ERROR("addPort(PortBase&) failed.") return # void registerPort(PortService_ptr port); # def registerPortByReference(self, port_ref): # self._rtcout.RTC_TRACE("registerPortByReference()") # self.addPortByReference(port_ref) # return # new interface. since 1.0.0-RELEASE # void addPort(PortBase& port); def addPort(self, port): self._rtcout.RTC_TRACE("addPort()") if isinstance(port, OpenRTM_aist.CorbaPort): self._rtcout.RTC_TRACE("addPort(CorbaPort)") propkey = "port.corbaport." prop = self._properties.getNode(propkey) if prop: self._properties.getNode(propkey).mergeProperties(self._properties.getNode("port.corba")) port.init(self._properties.getNode(propkey)) port.setOwner(self.getObjRef()) elif isinstance(port, OpenRTM_aist.PortBase): self._rtcout.RTC_TRACE("addPort(PortBase)") port.setOwner(self.getObjRef()) port.setPortConnectListenerHolder(self._portconnListeners) self.onAddPort(port.getPortProfile()) elif isinstance(port, RTC._objref_PortService): self._rtcout.RTC_TRACE("addPort(PortService)") return self._portAdmin.addPort(port) # new interface. since 1.0.0-RELEASE # void addPort(PortService_ptr port); # def addPortByReference(self, port_ref): # self._rtcout.RTC_TRACE("addPortByReference()") # self._portAdmin.registerPortByReference(port_ref) # return ## # @if jp # # @brief [local interface] DataInPort ����Ͽ���� # # RTC ���ݻ����� DataInPort ����Ͽ���롣 # Port �Υץ��ѥƥ��˥ǡ����ݡ��ȤǤ��뤳��("port.dataport")�� # TCP����Ѥ��뤳��("tcp_any")�����ꤹ��ȤȤ�ˡ� DataInPort �� # ���󥹥��󥹤�����������Ͽ���롣 # # @param self # @param name port ̾�� # @param inport ��Ͽ�о� DataInPort # # @else # # @endif def registerInPort(self, name, inport): self._rtcout.RTC_TRACE("registerInPort(%s)", name) if not self.addInPort(name, inport): self._rtcout.RTC_ERROR("addInPort(%s) failed.", name) return # new interface. since 1.0.0-RELEASE def addInPort(self, name, inport): self._rtcout.RTC_TRACE("addInPort(%s)", name) propkey = "port.inport." + name prop_ = copy.copy(self._properties.getNode(propkey)) prop_.mergeProperties(self._properties.getNode("port.inport.dataport")) ret = self.addPort(inport) if not ret: self._rtcout.RTC_ERROR("addInPort() failed.") return ret inport.init(self._properties.getNode(propkey)) self._inports.append(inport) return ret ## # @if jp # # @brief [local interface] DataOutPort ����Ͽ���� # # RTC ���ݻ����� DataOutPor t����Ͽ���롣 # Port �Υץ��ѥƥ��˥ǡ����ݡ��ȤǤ��뤳��("port.dataport")�� # TCP����Ѥ��뤳��("tcp_any")�����ꤹ��ȤȤ�ˡ� DataOutPort �� # ���󥹥��󥹤�����������Ͽ���롣 # # @param self # @param name port ̾�� # @param outport ��Ͽ�о� DataInPort # # @else # # @endif # void registerOutPort(const char* name, OutPortBase& outport); def registerOutPort(self, name, outport): self._rtcout.RTC_TRACE("registerOutPort(%s)", name) if not self.addOutPort(name, outport): self._rtcout.RTC_ERROR("addOutPort(%s) failed.", name) return # new interface. since 1.0.0-RELEASE # void addOutPort(const char* name, OutPortBase& outport); def addOutPort(self, name, outport): self._rtcout.RTC_TRACE("addOutPort(%s)", name) propkey = "port.outport." + name prop_ = copy.copy(self._properties.getNode(propkey)) prop_.mergeProperties(self._properties.getNode("port.outport.dataport")) ret = self.addPort(outport) if not ret: self._rtcout.RTC_ERROR("addOutPort() failed.") return ret outport.init(self._properties.getNode(propkey)) self._outports.append(outport) return ret ## # @if jp # # @brief [local interface] InPort ����Ͽ�������� # # RTC ���ݻ�����InPort����Ͽ�������롣 # # @param port ����о� Port # @return ������(�������:true���������:false) # # @else # # @brief [local interface] Unregister InPort # # This operation unregisters a InPort held by this RTC. # # @param port Port which is unregistered # @return Unregister result (Successful:true, Failed:false) # # @endif # # bool removeInPort(InPortBase& port); def removeInPort(self, port): self._rtcout.RTC_TRACE("removeInPort()") ret = self.removePort(inport) if ret: for inport in self._inports: if port == inport: try: self._inports.remove(port) except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) return True return False ## # @if jp # # @brief [local interface] OutPort ����Ͽ�������� # # RTC ���ݻ�����OutPort����Ͽ�������롣 # # @param port ����о� Port # @return ������(�������:true���������:false) # # @else # # @brief [local interface] Unregister OutPort # # This operation unregisters a OutPort held by this RTC. # # @param port Port which is unregistered # @return Unregister result (Successful:true, Failed:false) # # @endif # # bool removeOutPort(OutPortBase& port); def removeOutPort(self, port): self._rtcout.RTC_TRACE("removeOutPort()") ret = self.removePort(outport) if ret: for outport in self._outports: if port == outport: try: self._outports.remove(port) except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) return True return False ## # @if jp # # @brief [local interface] Port ����Ͽ�������� # # RTC ���ݻ�����Port����Ͽ�������롣 # # @param self # @param port ����о� Port # # @else # # @brief [local interface] Unregister Port # # This operation unregisters a Port to be held by this RTC. # # @param port Port which is unregistered in the RTC # # @endif # void RTObject_impl::deletePort(PortBase& port) def deletePort(self, port): self._rtcout.RTC_TRACE("deletePort()") if not self.removePort(port): self._rtcout.RTC_ERROR("removePort() failed.") return # new interface. since 1.0.0-RELEASE def removePort(self, port): self._rtcout.RTC_TRACE("removePort()") if isinstance(port, OpenRTM_aist.PortBase) or isinstance(port, OpenRTM_aist.CorbaPort): self.onRemovePort(port.getPortProfile()) return self._portAdmin.removePort(port) ## # @if jp # # @brief [local interface] ̾������ˤ�� Port ����Ͽ�������� # # ̾�Τ���ꤷ�� RTC ���ݻ�����Port����Ͽ�������롣 # # @param self # @param port_name ����о� Port ̾ # # @else # # @endif def deletePortByName(self, port_name): self._rtcout.RTC_TRACE("deletePortByName(%s)", port_name) self._portAdmin.deletePortByName(port_name) return ## # @if jp # # @brief [local interface] �¹ԥ���ƥ����Ȥ�������� # # get_context() ��Ʊ����ǽ�Υ��������ǡ��㤤�Ϥʤ��� # ���δؿ��ϰʲ��δؿ���ǸƤФ�뤳�Ȥ�����Ȥ��Ƥ��롣 # # - onStartup() # - onShutdown() # - onActivated() # - onDeactivated() # - onExecute() # - onAborting() # - onError() # - onReset() # - onStateUpdate() # - onRateChanged() # # ���δؿ��ΰ����Ϥ����δؿ��ΰ��� UniquieID exec_handle �Ǥʤ� # ��Фʤ�ʤ��� # # @param ec_id �嵭�ؿ�����1���� exec_handle ���Ϥ�ɬ�פ����롣 # # @else # # @brief [local interface] Getting current execution context # # This function is the local version of get_context(). completely # same as get_context() function. This function is assumed to be # called from the following functions. # # - onStartup() # - onShutdown() # - onActivated() # - onDeactivated() # - onExecute() # - onAborting() # - onError() # - onReset() # - onStateUpdate() # - onRateChanged() # # The argument of this function should be the first argument # (UniqueId ec_id) of the above functions. # # @param ec_id The above functions' first argument "exec_handle." # # @endif # # ExecutionContext_ptr getExecutionContext(RTC::UniqueId ec_id); def getExecutionContext(self, ec_id): return self.get_context(ec_id) ## # @if jp # # @brief [local interface] �¹ԥ���ƥ����Ȥμ¹ԥ졼�Ȥ�������� # # ���߼¹���μ¹ԥ���ƥ����Ȥμ¹ԥ졼�Ȥ�������롣�¹ԥ���ƥ� # ���Ȥ�Kind��PERIODIC�ʳ��ξ���ư���̤����Ǥ��롣���δؿ��ϰ� # ���δؿ���ǸƤФ�뤳�Ȥ�����Ȥ��Ƥ��롣 # # - onStartup() # - onShutdown() # - onActivated() # - onDeactivated() # - onExecute() # - onAborting() # - onError() # - onReset() # - onStateUpdate() # - onRateChanged() # # ���δؿ��ΰ����Ϥ����δؿ��ΰ��� UniquieID exec_handle �Ǥʤ� # ��Фʤ�ʤ��� # # @param ec_id �嵭�ؿ�����1���� exec_handle ���Ϥ�ɬ�פ����롣 # # @else # # @brief [local interface] Getting current context' execution rate # # This function returns current execution rate in this # context. If this context's kind is not PERIODC, behavior is not # defined. This function is assumed to be called from the # following functions. # # - onStartup() # - onShutdown() # - onActivated() # - onDeactivated() # - onExecute() # - onAborting() # - onError() # - onReset() # - onStateUpdate() # - onRateChanged() # # The argument of this function should be the first argument # (UniqueId ec_id) of the above functions. # # @param ec_id The above functions' first argument "exec_handle." # # @endif # # double getExecutionRate(RTC::UniqueId ec_id); def getExecutionRate(self, ec_id): ec = self.getExecutionContext(ec_id) if CORBA.is_nil(ec): return 0.0 return ec.get_rate() ## # @if jp # # @brief [local interface] �¹ԥ���ƥ����Ȥμ¹ԥ졼�Ȥ����ꤹ�� # # ���߼¹���μ¹ԥ���ƥ����Ȥμ¹ԥ졼�Ȥ����ꤹ�롣�¹ԥ���ƥ� # ���Ȥ�Kind��PERIODIC�ʳ��ξ���ư���̤����Ǥ��롣���δؿ��ϰ� # ���δؿ���ǸƤФ�뤳�Ȥ�����Ȥ��Ƥ��롣 # # - onStartup() # - onShutdown() # - onActivated() # - onDeactivated() # - onExecute() # - onAborting() # - onError() # - onReset() # - onStateUpdate() # - onRateChanged() # # ���δؿ��ΰ����Ϥ����δؿ��ΰ��� UniquieID exec_handle �Ǥʤ� # ��Фʤ�ʤ��� # # @param ec_id �嵭�ؿ�����1���� exec_handle ���Ϥ�ɬ�פ����롣 # @param rate �¹ԥ졼�Ȥ� [Hz] ��Ϳ���� # # @else # # @brief [local interface] Setting current context' execution rate # # This function sets a execution rate in the context. If this # context's kind is not PERIODC, behavior is not defined. This # function is assumed to be called from the following functions. # # - onStartup() # - onShutdown() # - onActivated() # - onDeactivated() # - onExecute() # - onAborting() # - onError() # - onReset() # - onStateUpdate() # - onRateChanged() # # The argument of this function should be the first argument # (UniqueId ec_id) of the above functions. # # @param ec_id The above functions' first argument "exec_handle." # @param rate Execution rate in [Hz]. # # @endif # # ReturnCode_t setExecutionRate(RTC::UniqueId ec_id, double rate); def setExecutionRate(self, ec_id, rate): ec = self.getExecutionContext(ec_id) if CORBA.is_nil(ec): return RTC.RTC_ERROR ec.set_rate(rate) return RTC.RTC_OK ## # @if jp # # @brief [local interface] �¹ԥ���ƥ����Ȥν�ͭ����Ĵ�٤� # # ���߼¹���μ¹ԥ���ƥ����Ȥν�ͭ����Ĵ�٤롣���δؿ��ϰʲ��δ� # ����ǸƤФ�뤳�Ȥ�����Ȥ��Ƥ��롣 # # - onStartup() # - onShutdown() # - onActivated() # - onDeactivated() # - onExecute() # - onAborting() # - onError() # - onReset() # - onStateUpdate() # - onRateChanged() # # ���δؿ��ΰ����Ϥ����δؿ��ΰ��� UniquieID exec_handle �Ǥʤ� # ��Фʤ�ʤ��� # # @param ec_id �嵭�ؿ�����1���� exec_handle ���Ϥ�ɬ�פ����롣 # @return true: ���Ȥμ¹ԥ���ƥ����ȡ�false: ¾�μ¹ԥ���ƥ����� # # @else # # @brief [local interface] Checking if the current context is own context # # This function checks if the current context is own execution # context. This function is assumed to be called from the # following functions. # # - onStartup() # - onShutdown() # - onActivated() # - onDeactivated() # - onExecute() # - onAborting() # - onError() # - onReset() # - onStateUpdate() # - onRateChanged() # # The argument of this function should be the first argument # (UniqueId ec_id) of the above functions. # # @param ec_id The above functions' first argument "exec_handle." # @return true: Own context, false: other's context # # @endif # # bool isOwnExecutionContext(RTC::UniqueId ec_id); def isOwnExecutionContext(self, ec_id): global ECOTHER_OFFSET if ec_id < ECOTHER_OFFSET: return True return False ## # @if jp # # @brief [local interface] ���֤� Inactive �����ܤ����� # # ���֤� Active ���� Inactive �����ܤ����롣���δؿ��ϰʲ��δ� # ����ǸƤФ�뤳�Ȥ�����Ȥ��Ƥ��롣 # # - onActivated() # - onExecute() # - onStateUpdate() # # ���δؿ��ΰ����Ͼ嵭�δؿ��ΰ��� UniquieID exec_handle �Ǥʤ� # ��Фʤ�ʤ��� # # @param ec_id �嵭�ؿ�����1���� exec_handle ���Ϥ�ɬ�פ����롣 # @return �꥿���󥳡��� # # @else # # @brief [local interface] Make transition to Inactive state # # This function makes transition from Active to Inactive # state. This function is assumed to be called from the following # functions. # # - onActivated() # - onExecute() # - onStateUpdate() # # The argument of this function should be the first argument # (UniqueId ec_id) of the above function. # # @param ec_id The above functions' first argument "exec_handle." # @return Return code # # @endif # # ReturnCode_t deactivate(RTC::UniqueId ec_id); def deactivate(self, ec_id): ec = self.getExecutionContext(ec_id) if CORBA.is_nil(ec): return RTC.RTC_ERROR return ec.deactivate_component(self.getObjRef()) ## # @if jp # # @brief [local interface] ���֤� Active �����ܤ����� # # ���֤� Inactive ���� Active �����ܤ����롣���δؿ��ϰʲ��δ� # ����ǸƤФ�뤳�Ȥ�����Ȥ��Ƥ��롣 # # - onStartup() # - onDeactivated() # # ���δؿ��ΰ����Ͼ嵭�δؿ��ΰ��� UniquieID exec_handle �Ǥʤ� # ��Фʤ�ʤ��� # # @param ec_id �嵭�ؿ�����1���� exec_handle ���Ϥ�ɬ�פ����롣 # @return �꥿���󥳡��� # # @else # # @brief [local interface] Make transition to Active state # # This function makes transition from Inactive to Active # state. This function is assumed to be called from the following # functions. # # - onStartup() # - onDeactivated() # # The argument of this function should be the first argument # (UniqueId ec_id) of the above function. # # @param ec_id The above functions' first argument "exec_handle." # @return Return code # # @endif # # ReturnCode_t activate(RTC::UniqueId ec_id); def activate(self, ec_id): ec = self.getExecutionContext(ec_id) if CORBA.is_nil(ec): return RTC.RTC_ERROR return ec.activate_component(self.getObjRef()) ## # @if jp # # @brief [local interface] ���֤�ꥻ�åȤ� Inactive �����ܤ����� # # ���֤� Error ���� Inactive �����ܤ����롣���δؿ��ϰʲ��δ� # ����ǸƤФ�뤳�Ȥ�����Ȥ��Ƥ��롣 # # - onError() # # ���δؿ��ΰ����Ͼ嵭�δؿ��ΰ��� UniquieID exec_handle �Ǥʤ� # ��Фʤ�ʤ��� # # @param ec_id �嵭�ؿ�����1���� exec_handle ���Ϥ�ɬ�פ����롣 # @return �꥿���󥳡��� # # @else # # @brief [local interface] Resetting and go to Inactive state # # This function reset RTC and makes transition from Error to Inactive # state. This function is assumed to be called from the following # functions. # # - onError() # # The argument of this function should be the first argument # (UniqueId ec_id) of the above function. # # @param ec_id The above functions' first argument "exec_handle." # @return Return code # # @endif # # ReturnCode_t reset(RTC::UniqueId ec_id); def reset(self, ec_id): ec = self.getExecutionContext(ec_id) if CORBA.is_nil(ec): return RTC.RTC_ERROR return ec.reset_component(self.getObjRef()) ## # @if jp # @brief [local interface] SDO service provider �򥻥åȤ��� # @else # @brief [local interface] Set a SDO service provider # @endif # # bool addSdoServiceProvider(const SDOPackage::ServiceProfile& prof, # SdoServiceProviderBase* provider); def addSdoServiceProvider(self, prof, provider): return self._sdoservice.addSdoServiceProvider(prof, provider) ## # @if jp # @brief [local interface] SDO service provider �������� # @else # @brief [local interface] Remove a SDO service provider # @endif # # bool removeSdoServiceProvider(const char* id); def removeSdoServiceProvider(self, id): return self._sdoservice.removeSdoServiceProvider(id) ## # @if jp # @brief [local interface] SDO service consumer �򥻥åȤ��� # @else # @brief [local interface] Set a SDO service consumer # @endif # # bool addSdoServiceConsumer(const SDOPackage::ServiceProfile& prof); def addSdoServiceConsumer(self, prof): return self._sdoservice.addSdoServiceConsumer(prof) ## # @if jp # @brief [local interface] SDO service consumer �������� # @else # @brief [local interface] Remove a SDO service consumer # @endif # # bool removeSdoServiceConsumer(const char* id); def removeSdoServiceConsumer(self, id): return self._sdoservice.removeSdoServiceConsumer(id) ## # @if jp # # @brief �� InPort �Υǡ������ɤ߹��ࡣ # # RTC ���ݻ��������Ƥ� InPort �Υǡ������ɤ߹��ࡣ # # @return �ɤ߹��߷��(���ݡ��Ȥ��ɤ߹�������:true������:false) # # @else # # @brief Readout the value from All InPorts. # # This operation read the value from all InPort # registered in the RTC. # # @return result (Successful:true, Failed:false) # # @endif # # bool readAll(); def readAll(self): self._rtcout.RTC_TRACE("readAll()") ret = True for inport in self._inports: if not inport.read(): self._rtcout.RTC_DEBUG("The error occurred in readAll().") ret = False if not self._readAllCompletion: return False return ret ## # @if jp # # @brief �� OutPort ��write()�᥽�åɤ򥳡��뤹�롣 # # RTC ���ݻ��������Ƥ� OutPort ��write()�᥽�åɤ򥳡��뤹�롣 # # @return �ɤ߹��߷��(���ݡ��Ȥؤν񤭹�������:true������:false) # # @else # # @brief The write() method of all OutPort is called. # # This operation call the write() method of all OutPort # registered in the RTC. # # @return result (Successful:true, Failed:false) # # @endif # # bool writeAll(); def writeAll(self): self._rtcout.RTC_TRACE("writeAll()") ret = True for outport in self._outports: if not outport.write(): self._rtcout.RTC_DEBUG("The error occurred in writeAll().") ret = False if not self._writeAllCompletion: return False return ret ## # @if jp # # @brief onExecute()�¹����Ǥ�readAll()�᥽�åɤθƽФ�ͭ���ޤ���̵���ˤ��롣 # # ���Υ᥽�åɤ�ѥ�᡼����true�Ȥ��ƸƤֻ��ˤ�ꡢonExecute()�¹����� # readAll()���ƽФ����褦�ˤʤ롣 # �ѥ�᡼����false�ξ��ϡ�readAll()�ƽФ�̵���ˤ��롣 # # @param read(default:true) # (readAll()�᥽�åɸƽФ���:true, readAll()�᥽�åɸƽФʤ�:false) # # @param completion(default:false) # readAll()�ˤơ��ɤ줫�ΰ�Ĥ�InPort��read()�����Ԥ��Ƥ����Ƥ�InPort��read()��ƤӽФ�:true, # readAll()�ˤơ��ɤ줫�ΰ�Ĥ�InPort��read()�����Ԥ�����硢������false��ȴ����:false # # @else # # @brief Set whether to execute the readAll() method. # # Set whether to execute the readAll() method. # # @param read(default:true) # (readAll() is called:true, readAll() isn't called:false) # # @param completion(default:false) # All InPort::read() calls are completed.:true, # If one InPort::read() is False, return false.:false # # @param completion(default:false) # # @endif # # void setReadAll(bool read=true, bool completion=false); def setReadAll(self, read=True, completion=False): self._readAll = read self._readAllCompletion = completion ## # @if jp # # @brief onExecute()�¹Ը��writeAll()�᥽�åɤθƽФ�ͭ���ޤ���̵���ˤ��롣 # # ���Υ᥽�åɤ�ѥ�᡼����true�Ȥ��ƸƤֻ��ˤ�ꡢonExecute()�¹Ը�� # writeAll()���ƽФ����褦�ˤʤ롣 # �ѥ�᡼����false�ξ��ϡ�writeAll()�ƽФ�̵���ˤ��롣 # # @param write(default:true) # (writeAll()�᥽�åɸƽФ���:true, writeAll()�᥽�åɸƽФʤ�:false) # # @param completion(default:false) # writeAll()�ˤơ��ɤ줫�ΰ�Ĥ�OutPort��write()�����Ԥ��Ƥ����Ƥ�OutPort��write()��ƤӽФ���Ԥ�:true, # writeAll()�ˤơ��ɤ줫�ΰ�Ĥ�OutPort��write()�����Ԥ�����硢������false��ȴ����:false # # @else # # @brief Set whether to execute the writeAll() method. # # Set whether to execute the writeAll() method. # # @param write(default:true) # (writeAll() is called:true, writeAll() isn't called:false) # # @param completion(default:false) # All OutPort::write() calls are completed.:true, # If one OutPort::write() is False, return false.:false # # @endif # # void setWriteAll(bool write=true, bool completion=false); def setWriteAll(self, write=True, completion=False): self._writeAll = write self._writeAllCompletion = completion ## # @if jp # # @brief �� Port ����Ͽ�������� # # RTC ���ݻ��������Ƥ� Port �������롣 # # @param self # # @else # # @brief Unregister the All Portse # # This operation deactivates the all Port and deletes the all Port's # registrations in the RTC.. # # @endif def finalizePorts(self): self._rtcout.RTC_TRACE("finalizePorts()") self._portAdmin.finalizePorts() self._inports = [] self._outports = [] return def finalizeContexts(self): self._rtcout.RTC_TRACE("finalizeContexts()") len_ = len(self._eclist) for i in range(len_): idx = (len_ - 1) - i self._eclist[idx].stop() try: self._poa.deactivate_object(self._poa.servant_to_id(self._eclist[idx])) except: self._rtcout.RTC_TRACE(OpenRTM_aist.Logger.print_exception()) del self._eclist[idx] if self._eclist: self._eclist = [] return ## # @if jp # @brief PreComponentActionListener �ꥹ�ʤ��ɲä��� # # ComponentAction �����ؿ��θƤӽФ�ľ���Υ��٥�Ȥ˴�Ϣ����Ƽ�� # ���ʤ����ꤹ�롣 # # ����Ǥ���ꥹ�ʤΥ����פȥ�����Хå����٥�Ȥϰʲ����̤� # # - PRE_ON_INITIALIZE: onInitialize ľ�� # - PRE_ON_FINALIZE: onFinalize ľ�� # - PRE_ON_STARTUP: onStartup ľ�� # - PRE_ON_SHUTDOWN: onShutdown ľ�� # - PRE_ON_ACTIVATED: onActivated ľ�� # - PRE_ON_DEACTIVATED: onDeactivated ľ�� # - PRE_ON_ABORTING: onAborted ľ�� # - PRE_ON_ERROR: onError ľ�� # - PRE_ON_RESET: onReset ľ�� # - PRE_ON_EXECUTE: onExecute ľ�� # - PRE_ON_STATE_UPDATE: onStateUpdate ľ�� # # �ꥹ�ʤ� PreComponentActionListener ��Ѿ������ʲ��Υ����˥������� # operator() ��������Ƥ���ɬ�פ����롣 # # PreComponentActionListener::operator()(UniqueId ec_id) # # �ǥե���ȤǤϡ����δؿ���Ϳ�����ꥹ�ʥ��֥������Ȥν�ͭ���� # RTObject�˰ܤꡢRTObject���λ��⤷���ϡ� # removePreComponentActionListener() �ˤ�������˼�ưŪ�˲��Τ���롣 # �ꥹ�ʥ��֥������Ȥν�ͭ����ƤӽФ�¦�ǰݻ����������ϡ���3�� # ���� false ����ꤷ����ưŪ�ʲ��Τ��������뤳�Ȥ��Ǥ��롣 # # @param listener_type �ꥹ�ʥ����� # @param memfunc �ؿ����֥������� # @param autoclean �ꥹ�ʥ��֥������Ȥμ�ưŪ���Τ�Ԥ����ɤ����Υե饰 # # @else # @brief Adding PreComponentAction type listener # # This operation adds certain listeners related to ComponentActions # pre events. # The following listener types are available. # # - PRE_ON_INITIALIZE: before onInitialize # - PRE_ON_FINALIZE: before onFinalize # - PRE_ON_STARTUP: before onStartup # - PRE_ON_SHUTDOWN: before onShutdown # - PRE_ON_ACTIVATED: before onActivated # - PRE_ON_DEACTIVATED: before onDeactivated # - PRE_ON_ABORTING: before onAborted # - PRE_ON_ERROR: before onError # - PRE_ON_RESET: before onReset # - PRE_ON_EXECUTE: before onExecute # - PRE_ON_STATE_UPDATE: before onStateUpdate # # Listeners should have the following function operator(). # # PreComponentActionListener::operator()(UniqueId ec_id) # # The ownership of the given listener object is transferred to # this RTObject object in default. The given listener object will # be destroied automatically in the RTObject's dtor or if the # listener is deleted by removePreComponentActionListener() function. # If you want to keep ownership of the listener object, give # "false" value to 3rd argument to inhibit automatic destruction. # # @param listener_type A listener type # @param memfunc member function object # @param autoclean A flag for automatic listener destruction # # @endif # # template <class Listener> # PreComponentActionListener* # addPreComponentActionListener(PreCompActionListenerType listener_type, # void (Listener::*memfunc)(UniqueId ec_id), # bool autoclean = true) def addPreComponentActionListener(self, listener_type, memfunc, autoclean = True): class Noname(OpenRTM_aist.PreComponentActionListener): def __init__(self, memfunc): self._memfunc = memfunc def __call__(self, ec_id): self._memfunc(ec_id) return listener = Noname(memfunc) self._actionListeners.preaction_[listener_type].addListener(listener, autoclean) return listener ## # @if jp # @brief PreComponentActionListener �ꥹ�ʤ������� # # ���ꤷ���Ƽ�ꥹ�ʤ������롣 # # @param listener_type �ꥹ�ʥ����� # @param listener �ꥹ�ʥ��֥������ȤؤΥݥ��� # # @else # @brief Removing PreComponentAction type listener # # This operation removes a specified listener. # # @param listener_type A listener type # @param listener A pointer to a listener object # # @endif # # void # removePreComponentActionListener(PreComponentActionListenerType listener_type, # PreComponentActionListener* listener); def removePreComponentActionListener(self, listener_type, listener): self._actionListeners.preaction_[listener_type].removeListener(listener) return ## # @if jp # @brief PostComponentActionListener �ꥹ�ʤ��ɲä��� # # ComponentAction �����ؿ��θƤӽФ�ľ��Υ��٥�Ȥ˴�Ϣ����Ƽ�� # ���ʤ����ꤹ�롣 # # ����Ǥ���ꥹ�ʤΥ����פȥ�����Хå����٥�Ȥϰʲ����̤� # # - POST_ON_INITIALIZE: onInitialize ľ�� # - POST_ON_FINALIZE: onFinalize ľ�� # - POST_ON_STARTUP: onStartup ľ�� # - POST_ON_SHUTDOWN: onShutdown ľ�� # - POST_ON_ACTIVATED: onActivated ľ�� # - POST_ON_DEACTIVATED: onDeactivated ľ�� # - POST_ON_ABORTING: onAborted ľ�� # - POST_ON_ERROR: onError ľ�� # - POST_ON_RESET: onReset ľ�� # - POST_ON_EXECUTE: onExecute ľ�� # - POST_ON_STATE_UPDATE: onStateUpdate ľ�� # # �ꥹ�ʤ� PostComponentActionListener ��Ѿ������ʲ��Υ����˥������� # operator() ��������Ƥ���ɬ�פ����롣 # # PostComponentActionListener::operator()(UniqueId ec_id, ReturnCode_t ret) # # �ǥե���ȤǤϡ����δؿ���Ϳ�����ꥹ�ʥ��֥������Ȥν�ͭ���� # RTObject�˰ܤꡢRTObject���λ��⤷���ϡ� # removePostComponentActionListener() �ˤ�������˼�ưŪ�˲��Τ���롣 # �ꥹ�ʥ��֥������Ȥν�ͭ����ƤӽФ�¦�ǰݻ����������ϡ���3�� # ���� false ����ꤷ����ưŪ�ʲ��Τ��������뤳�Ȥ��Ǥ��롣 # # @param listener_type �ꥹ�ʥ����� # @param memfunc �ؿ����֥������� # @param autoclean �ꥹ�ʥ��֥������Ȥμ�ưŪ���Τ�Ԥ����ɤ����Υե饰 # # @else # @brief Adding PostComponentAction type listener # # This operation adds certain listeners related to ComponentActions # post events. # The following listener types are available. # # - POST_ON_INITIALIZE: after onInitialize # - POST_ON_FINALIZE: after onFinalize # - POST_ON_STARTUP: after onStartup # - POST_ON_SHUTDOWN: after onShutdown # - POST_ON_ACTIVATED: after onActivated # - POST_ON_DEACTIVATED: after onDeactivated # - POST_ON_ABORTING: after onAborted # - POST_ON_ERROR: after onError # - POST_ON_RESET: after onReset # - POST_ON_EXECUTE: after onExecute # - POST_ON_STATE_UPDATE: after onStateUpdate # # Listeners should have the following function operator(). # # PostComponentActionListener::operator()(UniqueId ec_id, ReturnCode_t ret) # # The ownership of the given listener object is transferred to # this RTObject object in default. The given listener object will # be destroied automatically in the RTObject's dtor or if the # listener is deleted by removePostComponentActionListener() function. # If you want to keep ownership of the listener object, give # "false" value to 3rd argument to inhibit automatic destruction. # # @param listener_type A listener type # @param memfunc member function object # @param autoclean A flag for automatic listener destruction # # @endif # # template <class Listener> # PostComponentActionListener* # addPostComponentActionListener(PostCompActionListenerType listener_type, # void (Listener::*memfunc)(UniqueId ec_id, # ReturnCode_t ret), # bool autoclean = true) def addPostComponentActionListener(self, listener_type, memfunc, autoclean = True): class Noname(OpenRTM_aist.PostComponentActionListener): def __init__(self, memfunc): self._memfunc = memfunc return def __call__(self, ec_id, ret): self._memfunc(ec_id, ret) return listener = Noname(memfunc) self._actionListeners.postaction_[listener_type].addListener(listener, autoclean) return listener ## # @if jp # @brief PostComponentActionListener �ꥹ�ʤ������� # # ���ꤷ���Ƽ�ꥹ�ʤ������롣 # # @param listener_type �ꥹ�ʥ����� # @param listener �ꥹ�ʥ��֥������ȤؤΥݥ��� # # @else # @brief Removing PostComponentAction type listener # # This operation removes a specified listener. # # @param listener_type A listener type # @param listener A pointer to a listener object # # @endif ## # void # removePostComponentActionListener(PostComponentActionListenerType listener_type, # PostComponentActionListener* listener); def removePostComponentActionListener(self, listener_type, listener): self._actionListeners.postaction_[listener_type].removeListener(listener) return ## # @if jp # @brief PortActionListener �ꥹ�ʤ��ɲä��� # # Port���ɲá�������˥�����Хå������Ƽ�ꥹ�ʤ����ꤹ�롣 # # ����Ǥ���ꥹ�ʤΥ����פȥ�����Хå����٥�Ȥϰʲ����̤� # # - ADD_PORT: Port�ɲû� # - REMOVE_PORT: Port����� # # �ꥹ�ʤ� PortActionListener ��Ѿ������ʲ��Υ����˥������� # operator() ��������Ƥ���ɬ�פ����롣 # # PortActionListener::operator()(PortProfile& pprof) # # �ǥե���ȤǤϡ����δؿ���Ϳ�����ꥹ�ʥ��֥������Ȥν�ͭ���� # RTObject�˰ܤꡢRTObject���λ��⤷���ϡ� # removePortActionListener() �ˤ�������˼�ưŪ�˲��Τ���롣 # �ꥹ�ʥ��֥������Ȥν�ͭ����ƤӽФ�¦�ǰݻ����������ϡ���3�� # ���� false ����ꤷ����ưŪ�ʲ��Τ��������뤳�Ȥ��Ǥ��롣 # # @param listener_type �ꥹ�ʥ����� # @param memfunc �ؿ����֥������� # @param autoclean �ꥹ�ʥ��֥������Ȥμ�ưŪ���Τ�Ԥ����ɤ����Υե饰 # # @else # @brief Adding PortAction type listener # # This operation adds certain listeners related to ComponentActions # post events. # The following listener types are available. # # - ADD_PORT: At adding Port # - REMOVE_PORT: At removing Port # # Listeners should have the following function operator(). # # PortActionListener::operator()(RTC::PortProfile pprof) # # The ownership of the given listener object is transferred to # this RTObject object in default. The given listener object will # be destroied automatically in the RTObject's dtor or if the # listener is deleted by removePortActionListener() function. # If you want to keep ownership of the listener object, give # "false" value to 3rd argument to inhibit automatic destruction. # # @param listener_type A listener type # @param memfunc member function object # @param autoclean A flag for automatic listener destruction # # @endif # # template <class Listener> # PortActionListener* # addPortActionListener(PortActionListenerType listener_type, # void (Listener::*memfunc)(const RTC::PortProfile&), # bool autoclean=true) def addPortActionListener(self, listener_type, memfunc, autoclean = True): class Noname(OpenRTM_aist.PortActionListener): def __init__(self, memfunc): self._memfunc = memfunc return def __call__(self, pprofile): self._memfunc(pprofile) return listener = Noname(memfunc) self._actionListeners.portaction_[listener_type].addListener(listener, autoclean) return listener ## # @if jp # @brief PortActionListener �ꥹ�ʤ������� # # ���ꤷ���Ƽ�ꥹ�ʤ������롣 # # @param listener_type �ꥹ�ʥ����� # @param listener �ꥹ�ʥ��֥������ȤؤΥݥ��� # # @else # @brief Removing PortAction type listener # # This operation removes a specified listener. # # @param listener_type A listener type # @param listener A pointer to a listener object # # @endif # void # removePortActionListener(PortActionListenerType listener_type, # PortActionListener* listener); def removePortActionListener(self, listener_type, listener): self._actionListeners.portaction_[listener_type].removeListener(listener) return ## # @if jp # @brief ExecutionContextActionListener �ꥹ�ʤ��ɲä��� # # ExecutionContext���ɲá�������˥�����Хå������Ƽ�ꥹ�ʤ����ꤹ�롣 # # ����Ǥ���ꥹ�ʤΥ����פȥ�����Хå����٥�Ȥϰʲ����̤� # # - ATTACH_EC: ExecutionContext �����å��� # - DETACH_EC: ExecutionContext �ǥ��å��� # # �ꥹ�ʤ� ExecutionContextActionListener ��Ѿ������ʲ��Υ����˥������� # operator() ��������Ƥ���ɬ�פ����롣 # # ExecutionContextActionListener::operator()(UniqueId��ec_id) # # �ǥե���ȤǤϡ����δؿ���Ϳ�����ꥹ�ʥ��֥������Ȥν�ͭ���� # RTObject�˰ܤꡢRTObject���λ��⤷���ϡ� # removeExecutionContextActionListener() �ˤ�������˼�ưŪ�˲��Τ���롣 # �ꥹ�ʥ��֥������Ȥν�ͭ����ƤӽФ�¦�ǰݻ����������ϡ���3�� # ���� false ����ꤷ����ưŪ�ʲ��Τ��������뤳�Ȥ��Ǥ��롣 # # @param listener_type �ꥹ�ʥ����� # @param memfunc �ؿ����֥������� # @param autoclean �ꥹ�ʥ��֥������Ȥμ�ưŪ���Τ�Ԥ����ɤ����Υե饰 # # @else # @brief Adding ExecutionContextAction type listener # # This operation adds certain listeners related to ComponentActions # post events. # The following listener types are available. # # - ADD_PORT: At adding ExecutionContext # - REMOVE_PORT: At removing ExecutionContext # # Listeners should have the following function operator(). # # ExecutionContextActionListener::operator()(UniqueId ec_id) # # The ownership of the given listener object is transferred to # this RTObject object in default. The given listener object will # be destroied automatically in the RTObject's dtor or if the # listener is deleted by removeExecutionContextActionListener() function. # If you want to keep ownership of the listener object, give # "false" value to 3rd argument to inhibit automatic destruction. # # @param listener_type A listener type # @param memfunc member function object # @param autoclean A flag for automatic listener destruction # # @endif # # template <class Listener> # ECActionListener* # addExecutionContextActionListener(ECActionListenerType listener_type, # void (Listener::*memfunc)(UniqueId), # bool autoclean = true); def addExecutionContextActionListener(self, listener_type, memfunc, autoclean = True): class Noname(OpenRTM_aist.ExecutionContextActionListener): def __init__(self, memfunc): self._memfunc = memfunc return def __call__(self, ec_id): self._memfunc(ec_id) return listener = Noname(memfunc) self._actionListeners.ecaction_[listener_type].addListener(listener, autoclean) return listener ## # @if jp # @brief ExecutionContextActionListener �ꥹ�ʤ������� # # ���ꤷ���Ƽ�ꥹ�ʤ������롣 # # @param listener_type �ꥹ�ʥ����� # @param listener �ꥹ�ʥ��֥������ȤؤΥݥ��� # # @else # @brief Removing ExecutionContextAction type listener # # This operation removes a specified listener. # # @param listener_type A listener type # @param listener A pointer to a listener object # # @endif # # void # removeExecutionContextActionListener(ECActionListenerType listener_type, # ECActionListener* listener); def removeExecutionContextActionListener(self, listener_type, listener): self._actionListeners.ecaction_[listener_type].removeListener(listener) return ## # @if jp # @brief PortConnectListener �ꥹ�ʤ��ɲä��� # # Port����³������³������˸ƤӽФ����Ƽ�ꥹ�ʤ����ꤹ�롣 # # ����Ǥ���ꥹ�ʤΥ����פȥ�����Хå����٥�Ȥϰʲ����̤� # # - ON_NOTIFY_CONNECT: notify_connect() �ؿ���ƤӽФ�ľ�� # - ON_NOTIFY_DISCONNECT: notify_disconnect() �ƤӽФ�ľ�� # - ON_UNSUBSCRIBE_INTERFACES: notify_disconnect() ���IF���ɲ���� # # �ꥹ�ʤ� PortConnectListener ��Ѿ������ʲ��Υ����˥������� # operator() ��������Ƥ���ɬ�פ����롣 # # PortConnectListener::operator()(const char*, ConnectorProfile) # # �ǥե���ȤǤϡ����δؿ���Ϳ�����ꥹ�ʥ��֥������Ȥν�ͭ���� # RTObject�˰ܤꡢRTObject���λ��⤷���ϡ� # removePortConnectListener() �ˤ�������˼�ưŪ�˲��Τ���롣 # �ꥹ�ʥ��֥������Ȥν�ͭ����ƤӽФ�¦�ǰݻ����������ϡ���3�� # ���� false ����ꤷ����ưŪ�ʲ��Τ��������뤳�Ȥ��Ǥ��롣 # # @param listener_type �ꥹ�ʥ����� # @param memfunc �ؿ����֥������� # @param autoclean �ꥹ�ʥ��֥������Ȥμ�ưŪ���Τ�Ԥ����ɤ����Υե饰 # # @else # @brief Adding PortConnect type listener # # This operation adds certain listeners related to Port's connect actions. # The following listener types are available. # # - ON_NOTIFY_CONNECT: right after entering into notify_connect() # - ON_NOTIFY_DISCONNECT: right after entering into notify_disconnect() # - ON_UNSUBSCRIBE_INTERFACES: unsubscribing IF in notify_disconnect() # # Listeners should have the following function operator(). # # PortConnectListener::operator()(const char*, ConnectorProfile) # # The ownership of the given listener object is transferred to # this RTObject object in default. The given listener object will # be destroied automatically in the RTObject's dtor or if the # listener is deleted by removePortConnectListener() function. # If you want to keep ownership of the listener object, give # "false" value to 3rd argument to inhibit automatic destruction. # # @param listener_type A listener type # @param memfunc member function object # @param autoclean A flag for automatic listener destruction # # @endif # # template <class Listener> # PortConnectListener* # addPortConnectListener(PortConnectListenerType listener_type, # void (Listener::*memfunc)(const char*, # ConnectorProfile&), # bool autoclean = true) def addPortConnectListener(self, listener_type, memfunc, autoclean = True): class Noname(OpenRTM_aist.PortConnectListener): def __init__(self, memfunc): self._memfunc = memfunc return def __call__(self, portname, cprofile): self._memfunc(portname, cprofile) return listener = Noname(memfunc) self._portconnListeners.portconnect_[listener_type].addListener(listener, autoclean) return listener ## # @if jp # @brief PortConnectListener �ꥹ�ʤ������� # # ���ꤷ���Ƽ�ꥹ�ʤ������롣 # # @param listener_type �ꥹ�ʥ����� # @param listener �ꥹ�ʥ��֥������ȤؤΥݥ��� # # @else # @brief Removing PortConnect type listener # # This operation removes a specified listener. # # @param listener_type A listener type # @param listener A pointer to a listener object # # @endif # # void # removePortConnectListener(PortConnectListenerType listener_type, # PortConnectListener* listener); def removePortConnectListener(self, listener_type, listener): self._portconnListeners.portconnect_[listener_type].removeListener(listener) return ## # @if jp # @brief PortConnectRetListener �ꥹ�ʤ��ɲä��� # # Port����³������³������˸ƤӽФ����Ƽ�ꥹ�ʤ����ꤹ�롣 # # ����Ǥ���ꥹ�ʤΥ����פȥ�����Хå����٥�Ȥϰʲ����̤� # # - ON_CONNECT_NEXTPORT: notify_connect() ��Υ��������ɸƤӽФ�ľ�� # - ON_SUBSCRIBE_INTERFACES: notify_connect() ��Υ��󥿡��ե���������ľ�� # - ON_CONNECTED: nofity_connect() ��³������λ���˸ƤӽФ���� # - ON_DISCONNECT_NEXT: notify_disconnect() ��˥��������ɸƤӽФ�ľ�� # - ON_DISCONNECTED: notify_disconnect() �꥿����� # # �ꥹ�ʤ� PortConnectRetListener ��Ѿ������ʲ��Υ����˥������� # operator() ��������Ƥ���ɬ�פ����롣 # # PortConnectRetListener::operator()(const char*, ConnectorProfile) # # �ǥե���ȤǤϡ����δؿ���Ϳ�����ꥹ�ʥ��֥������Ȥν�ͭ���� # RTObject�˰ܤꡢRTObject���λ��⤷���ϡ� # removePortConnectRetListener() �ˤ�������˼�ưŪ�˲��Τ���롣 # �ꥹ�ʥ��֥������Ȥν�ͭ����ƤӽФ�¦�ǰݻ����������ϡ���3�� # ���� false ����ꤷ����ưŪ�ʲ��Τ��������뤳�Ȥ��Ǥ��롣 # # @param listener_type �ꥹ�ʥ����� # @param memfunc �ؿ����֥������� # @param autoclean �ꥹ�ʥ��֥������Ȥμ�ưŪ���Τ�Ԥ����ɤ����Υե饰 # # @else # @brief Adding PortConnectRet type listener # # This operation adds certain listeners related to Port's connect actions. # The following listener types are available. # # - ON_CONNECT_NEXTPORT: after cascade-call in notify_connect() # - ON_SUBSCRIBE_INTERFACES: after IF subscribing in notify_connect() # - ON_CONNECTED: completed nofity_connect() connection process # - ON_DISCONNECT_NEXT: after cascade-call in notify_disconnect() # - ON_DISCONNECTED: completed notify_disconnect() disconnection process # # Listeners should have the following function operator(). # # PortConnectRetListener::operator()(const char*, ConnectorProfile) # # The ownership of the given listener object is transferred to # this RTObject object in default. The given listener object will # be destroied automatically in the RTObject's dtor or if the # listener is deleted by removePortConnectRetListener() function. # If you want to keep ownership of the listener object, give # "false" value to 3rd argument to inhibit automatic destruction. # # @param listener_type A listener type # @param memfunc member function object # @param autoclean A flag for automatic listener destruction # # @endif # # template <class Listener> # PortConnectRetListener* # addPortConnectRetListener(PortConnectRetListenerType listener_type, # void (Listener::*memfunc)(const char*, # ConnectorProfile&, # ReturnCode_t)) def addPortConnectRetListener(self, listener_type, memfunc, autoclean = True): class Noname(OpenRTM_aist.PortConnectRetListener): def __init__(self, memfunc): self._memfunc = memfunc return def __call__(self, portname, cprofile, ret): self._memfunc(portname, cprofile, ret) return listener = Noname(memfunc) self._portconnListeners.portconnret_[listener_type].addListener(listener, autoclean) return listener ## # @if jp # @brief PortConnectRetListener �ꥹ�ʤ������� # # ���ꤷ���Ƽ�ꥹ�ʤ������롣 # # @param listener_type �ꥹ�ʥ����� # @param listener �ꥹ�ʥ��֥������ȤؤΥݥ��� # # @else # @brief Removing PortConnectRet type listener # # This operation removes a specified listener. # # @param listener_type A listener type # @param listener A pointer to a listener object # # @endif # # void # removePortConnectRetListener(PortConnectRetListenerType listener_type, # PortConnectRetListener* listener); def removePortConnectRetListener(self, listener_type, listener): self._portconnListeners.portconnret_[listener_type].removeListener(listener) return ## # @if jp # # @brief ConfigurationParamListener ���ɲä��� # # update(const char* config_set, const char* config_param) ���ƤФ줿�ݤ� # �����뤵���ꥹ�� ConfigurationParamListener ���ɲä��롣 # type �ˤϸ��ߤΤȤ��� ON_UPDATE_CONFIG_PARAM �Τߤ����롣 # # @param type ConfigurationParamListenerType�����͡� # ON_UPDATE_CONFIG_PARAM �����롣 # # @param memfunc �ؿ����֥������� # @param autoclean �ꥹ�ʥ��֥������Ȥ�ư�Ǻ�����뤫�ɤ����Υե饰 # # @else # # @brief Adding ConfigurationParamListener # # This function adds a listener object which is called when # update(const char* config_set, const char* config_param) is # called. In the type argument, currently only # ON_UPDATE_CONFIG_PARAM is allowed. # # @param type ConfigurationParamListenerType value # ON_UPDATE_CONFIG_PARAM is only allowed. # # @param memfunc member function object # @param autoclean a flag whether if the listener object autocleaned. # # @endif # # template <class Listener> # ConfigurationParamListener* # addConfigurationParamListener(ConfigurationParamListenerType listener_type, # void (Listener::*memfunc)(const char*, # const char*), # bool autoclean = true) def addConfigurationParamListener(self, type, memfunc, autoclean = True): class Noname(OpenRTM_aist.ConfigurationParamListener): def __init__(self, memfunc): self._memfunc = memfunc return def __call__(self, config_set_name, config_param_name): self._memfunc(config_set_name, config_param_name) return listener = Noname(memfunc) self._configsets.addConfigurationParamListener(type, listener, autoclean) return listener ## # @if jp # # @brief ConfigurationParamListener �������� # # addConfigurationParamListener ���ɲä��줿�ꥹ�ʥ��֥������Ȥ������롣 # # @param type ConfigurationParamListenerType�����͡� # ON_UPDATE_CONFIG_PARAM �����롣 # @param listener Ϳ�����ꥹ�ʥ��֥������ȤؤΥݥ��� # # @else # # @brief Removing ConfigurationParamListener # # This function removes a listener object which is added by # addConfigurationParamListener() function. # # @param type ConfigurationParamListenerType value # ON_UPDATE_CONFIG_PARAM is only allowed. # @param listener a pointer to ConfigurationParamListener listener object. # # @endif # # void removeConfigurationParamListener(ConfigurationParamListenerType type, # ConfigurationParamListener* listener); def removeConfigurationParamListener(self, type, listener): self._configsets.removeConfigurationParamListener(type, listener) return ## # @if jp # # @brief ConfigurationSetListener ���ɲä��� # # ConfigurationSet ���������줿�Ȥ��ʤɤ˸ƤФ��ꥹ�� # ConfigurationSetListener ���ɲä��롣�����ǽ�ʥ��٥�Ȥϰʲ��� # 2���ब���롣 # # - ON_SET_CONFIG_SET: setConfigurationSetValues() �� # ConfigurationSet ���ͤ����ꤵ�줿��硣 # - ON_ADD_CONFIG_SET: addConfigurationSet() �ǿ����� # ConfigurationSet ���ɲä��줿��硣 # # @param type ConfigurationSetListenerType�����͡� # @param memfunc �ؿ����֥������� # @param autoclean �ꥹ�ʥ��֥������Ȥ�ư�Ǻ�����뤫�ɤ����Υե饰 # # @else # # @brief Adding ConfigurationSetListener # # This function add a listener object which is called when # ConfigurationSet is updated. Available events are the followings. # # @param type ConfigurationSetListenerType value # @param memfunc member function object # @param autoclean a flag whether if the listener object autocleaned. # # @endif # # template <class Listener> # ConfigurationSetListener* # addConfigurationSetListener(ConfigurationSetListenerType listener_type, # void (Listener::*memfunc) # (const coil::Properties& config_set)) def addConfigurationSetListener(self, listener_type, memfunc, autoclean = True): class Noname(OpenRTM_aist.ConfigurationSetListener): def __init__(self, memfunc): self._memfunc = memfunc return def __call__(self, config_set): self._memfunc(config_set) return listener = Noname(memfunc) self._configsets.addConfigurationSetListener(listener_type, listener, autoclean) return listener ## # @if jp # # @brief ConfigurationSetListener �������� # # addConfigurationSetListener ���ɲä��줿�ꥹ�ʥ��֥������Ȥ������롣 # # @param type ConfigurationSetListenerType�����͡� # @param listener Ϳ�����ꥹ�ʥ��֥������ȤؤΥݥ��� # # @else # # @brief Removing ConfigurationSetListener # # This function removes a listener object which is added by # addConfigurationSetListener() function. # # @param type ConfigurationSetListenerType value # @param listener a pointer to ConfigurationSetListener listener object. # # @endif # # void removeConfigurationSetListener(ConfigurationSetListenerType type, # ConfigurationSetListener* listener); def removeConfigurationSetListener(self, type, listener): self._configsets.removeConfigurationSetListener(type, listener) return ## # @if jp # # @brief ConfigurationSetNameListener ���ɲä��� # # ConfigurationSetName ���������줿�Ȥ��ʤɤ˸ƤФ��ꥹ�� # ConfigurationSetNameListener ���ɲä��롣�����ǽ�ʥ��٥�Ȥϰʲ��� # 3���ब���롣 # # - ON_UPDATE_CONFIG_SET: ���� ConfigurationSet �����åץǡ��Ȥ��줿 # - ON_REMOVE_CONFIG_SET: ���� ConfigurationSet ��������줿 # - ON_ACTIVATE_CONFIG_SET: ���� ConfigurationSet �������ƥ��ֲ����줿 # # @param type ConfigurationSetNameListenerType�����͡� # @param memfunc �ؿ����֥������� # @param autoclean �ꥹ�ʥ��֥������Ȥ�ư�Ǻ�����뤫�ɤ����Υե饰 # # @else # # @brief Adding ConfigurationSetNameListener # # This function add a listener object which is called when # ConfigurationSetName is updated. Available events are the followings. # # - ON_UPDATE_CONFIG_SET: A ConfigurationSet has been updated. # - ON_REMOVE_CONFIG_SET: A ConfigurationSet has been deleted. # - ON_ACTIVATE_CONFIG_SET: A ConfigurationSet has been activated. # # @param type ConfigurationSetNameListenerType value # @param memfunc member function object # @param autoclean a flag whether if the listener object autocleaned. # # @endif # # template <class Listener> # ConfigurationSetNameListener* # addConfigurationSetNameListener(ConfigurationSetNameListenerType type, # void (Listener::*memfunc)(const char*)) def addConfigurationSetNameListener(self, type, memfunc, autoclean = True): class Noname(OpenRTM_aist.ConfigurationSetNameListener): def __init__(self, memfunc): self._memfunc = memfunc return def __call__(self, config_set_name): self._memfunc(config_set_name) return listener = Noname(memfunc) self._configsets.addConfigurationSetNameListener(type, listener, autoclean) return listener ## # @if jp # # @brief ConfigurationSetNameListener �������� # # addConfigurationSetNameListener ���ɲä��줿�ꥹ�ʥ��֥������Ȥ� # ������롣 # # @param type ConfigurationSetNameListenerType�����͡� # ON_UPDATE_CONFIG_PARAM �����롣 # @param listener Ϳ�����ꥹ�ʥ��֥������ȤؤΥݥ��� # # @else # # @brief Removing ConfigurationSetNameListener # # This function removes a listener object which is added by # addConfigurationSetNameListener() function. # # @param type ConfigurationSetNameListenerType value # ON_UPDATE_CONFIG_PARAM is only allowed. # @param listener a pointer to ConfigurationSetNameListener # listener object. # # @endif # void # removeConfigurationSetNameListener(ConfigurationSetNameListenerType type, # ConfigurationSetNameListener* listener); def removeConfigurationSetNameListener(self, type, listener): self._configsets.removeConfigurationSetNameListener(type, listener) return ## # @if jp # # @brief RTC ��λ���� # # RTC �ν�λ������¹Ԥ��롣 # �ݻ����Ƥ����� Port ����Ͽ��������ȤȤ�ˡ��������� CORBA ���֥������� # �������������RTC ��λ���롣 # # @param self # # @else # # @endif def shutdown(self): self._rtcout.RTC_TRACE("shutdown()") try: self.finalizePorts() self.finalizeContexts() self._poa.deactivate_object(self._poa.servant_to_id(self._SdoConfigImpl)) self._poa.deactivate_object(self._poa.servant_to_id(self)) except: self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception()) if self._manager: self._rtcout.RTC_DEBUG("Cleanup on Manager") self._manager.notifyFinalized(self) return # inline void preOnInitialize(UniqueId ec_id) def preOnInitialize(self, ec_id): self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_INITIALIZE].notify(ec_id) return # inline void preOnFinalize(UniqueId ec_id) def preOnFinalize(self, ec_id): self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_FINALIZE].notify(ec_id) return # inline void preOnStartup(UniqueId ec_id) def preOnStartup(self, ec_id): self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_STARTUP].notify(ec_id) return # inline void preOnShutdown(UniqueId ec_id) def preOnShutdown(self, ec_id): self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_SHUTDOWN].notify(ec_id) return # inline void preOnActivated(UniqueId ec_id) def preOnActivated(self, ec_id): self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_ACTIVATED].notify(ec_id) return # inline void preOnDeactivated(UniqueId ec_id) def preOnDeactivated(self, ec_id): self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_DEACTIVATED].notify(ec_id) return # inline void preOnAborting(UniqueId ec_id) def preOnAborting(self, ec_id): self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_ABORTING].notify(ec_id) return # inline void preOnError(UniqueId ec_id) def preOnError(self, ec_id): self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_ERROR].notify(ec_id) return # inline void preOnReset(UniqueId ec_id) def preOnReset(self, ec_id): self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_RESET].notify(ec_id) return # inline void preOnExecute(UniqueId ec_id) def preOnExecute(self, ec_id): self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_EXECUTE].notify(ec_id) return # inline void preOnStateUpdate(UniqueId ec_id) def preOnStateUpdate(self, ec_id): self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_STATE_UPDATE].notify(ec_id) return # inline void preOnRateChanged(UniqueId ec_id) def preOnRateChanged(self, ec_id): self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_RATE_CHANGED].notify(ec_id) return # inline void postOnInitialize(UniqueId ec_id, ReturnCode_t ret) def postOnInitialize(self, ec_id, ret): self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_INITIALIZE].notify(ec_id, ret) return # inline void postOnFinalize(UniqueId ec_id, ReturnCode_t ret) def postOnFinalize(self, ec_id, ret): self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_FINALIZE].notify(ec_id, ret) return # inline void postOnStartup(UniqueId ec_id, ReturnCode_t ret) def postOnStartup(self, ec_id, ret): self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_STARTUP].notify(ec_id, ret) return # inline void postOnShutdown(UniqueId ec_id, ReturnCode_t ret) def postOnShutdown(self, ec_id, ret): self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_SHUTDOWN].notify(ec_id, ret) return # inline void postOnActivated(UniqueId ec_id, ReturnCode_t ret) def postOnActivated(self, ec_id, ret): self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_ACTIVATED].notify(ec_id, ret) return # inline void postOnDeactivated(UniqueId ec_id, ReturnCode_t ret) def postOnDeactivated(self, ec_id, ret): self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_DEACTIVATED].notify(ec_id, ret) return # inline void postOnAborting(UniqueId ec_id, ReturnCode_t ret) def postOnAborting(self, ec_id, ret): self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_ABORTING].notify(ec_id, ret) return # inline void postOnError(UniqueId ec_id, ReturnCode_t ret) def postOnError(self, ec_id, ret): self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_ERROR].notify(ec_id, ret) return # inline void postOnReset(UniqueId ec_id, ReturnCode_t ret) def postOnReset(self, ec_id, ret): self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_RESET].notify(ec_id, ret) return # inline void postOnExecute(UniqueId ec_id, ReturnCode_t ret) def postOnExecute(self, ec_id, ret): self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_EXECUTE].notify(ec_id, ret) return # inline void postOnStateUpdate(UniqueId ec_id, ReturnCode_t ret) def postOnStateUpdate(self, ec_id, ret): self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_STATE_UPDATE].notify(ec_id, ret) return # inline void postOnRateChanged(UniqueId ec_id, ReturnCode_t ret) def postOnRateChanged(self, ec_id, ret): self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_RATE_CHANGED].notify(ec_id, ret) return # inline void onAddPort(const PortProfile& pprof) def onAddPort(self, pprof): self._actionListeners.portaction_[OpenRTM_aist.PortActionListenerType.ADD_PORT].notify(pprof) return # inline void onRemovePort(const PortProfile& pprof) def onRemovePort(self, pprof): self._actionListeners.portaction_[OpenRTM_aist.PortActionListenerType.REMOVE_PORT].notify(pprof) return # inline void onAttachExecutionContext(UniqueId ec_id) def onAttachExecutionContext(self, ec_id): self._actionListeners.ecaction_[OpenRTM_aist.ExecutionContextActionListenerType.EC_ATTACHED].notify(ec_id) return # inline void onDetachExecutionContext(UniqueId ec_id) def onDetachExecutionContext(self, ec_id): self._actionListeners.ecaction_[OpenRTM_aist.ExecutionContextActionListenerType.EC_DETACHED].notify(ec_id) return ## # @if jp # @class svc_name # @brief SDOService �Υץ��ե�����ꥹ�Ȥ���id�ǥ��������뤿��� # �ե��󥯥����饹 # @else # # @endif class svc_name: def __init__(self, _id): self._id= _id def __call__(self, prof): return self._id == prof.id #------------------------------------------------------------ # Functor #------------------------------------------------------------ ## # @if jp # @class nv_name # @brief NVList �����ѥե��󥯥� # @else # # @endif class nv_name: def __init__(self, _name): self._name = _name def __call__(self, nv): return self._name == nv.name ## # @if jp # @class ec_find # @brief ExecutionContext �����ѥե��󥯥� # @else # # @endif class ec_find: def __init__(self, _ec): self._ec = _ec def __call__(self, ecs): try: if not CORBA.is_nil(ecs): ec = ecs._narrow(RTC.ExecutionContext) return self._ec._is_equivalent(ec) except: print OpenRTM_aist.Logger.print_exception() return False return False ## # @if jp # @class ec_copy # @brief ExecutionContext Copy�ѥե��󥯥� # @else # # @endif class ec_copy: def __init__(self, eclist): self._eclist = eclist def __call__(self, ecs): if not CORBA.is_nil(ecs): self._eclist.append(ecs) ## # @if jp # @class deactivate_comps # @brief RTC ��������ѥե��󥯥� # @else # # @endif class deactivate_comps: def __init__(self, comp): self._comp = comp def __call__(self, ec): try: if not CORBA.is_nil(ec) and not ec._non_existent(): ec.deactivate_component(self._comp) ec.stop() except: print OpenRTM_aist.Logger.print_exception() # RtcBase = RTObject_impl
839  #
840  # @return ExecutionContextHandle
841  #
842  # Ϳ����줿�¹ԥ���ƥ����Ȥ˴�Ϣ�դ���줿�ϥ�ɥ���֤���
843  #
844  # @else
845  # @brief [CORBA interface] Return a handle of a ExecutionContext
846  #
847  # @param ExecutionContext
848  #
849  # @return ExecutionContextHandle
850  #
851  # This operation returns a handle that is associated with the given
852  # execution context.
853  #
854  # @endif
855  #
856  # virtual ExecutionContextHandle_t
857  # get_context_handle(ExecutionContext_ptr cxt)
858  def get_context_handle(self, cxt):
859  self._rtcout.RTC_TRACE("get_context_handle()")
860 
861  num = OpenRTM_aist.CORBA_SeqUtil.find(self._ecMine, self.ec_find(cxt))
862  if num != -1:
863  return long(num)
864 
865  num = OpenRTM_aist.CORBA_SeqUtil.find(self._ecOther, self.ec_find(cxt))
866  if num != -1:
867  return long(num)
868 
869  return long(-1)
870 
871 
872  #============================================================
873  # RTC::RTObject
874  #============================================================
875 
876 
898  self._rtcout.RTC_TRACE("get_component_profile()")
899  try:
900  prop_ = RTC.ComponentProfile(self._properties.getProperty("instance_name"),
901  self._properties.getProperty("type_name"),
902  self._properties.getProperty("description"),
903  self._properties.getProperty("version"),
904  self._properties.getProperty("vendor"),
905  self._properties.getProperty("category"),
906  self._portAdmin.getPortProfileList(),
907  self._profile.parent,
908  self._profile.properties)
909  OpenRTM_aist.NVUtil.copyFromProperties(self._profile.properties, self._properties)
910  return prop_
911  # return RTC.ComponentProfile(self._profile.instance_name,
912  # self._profile.type_name,
913  # self._profile.description,
914  # self._profile.version,
915  # self._profile.vendor,
916  # self._profile.category,
917  # self._portAdmin.getPortProfileList(),
918  # self._profile.parent,
919  # self._profile.properties)
920 
921  except:
922  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
923 
924  assert(False)
925  return None
926 
927 
928 
949  def get_ports(self):
950  self._rtcout.RTC_TRACE("get_ports()")
951  try:
952  return self._portAdmin.getPortServiceList()
953  except:
954  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
955 
956  assert(False)
957  return []
958 
959 
960 
961  # RTC::ComponentAction
962 
963 
994  def attach_context(self, exec_context):
995  global ECOTHER_OFFSET
996  self._rtcout.RTC_TRACE("attach_context()")
997  # ID: 0 - (offset-1) : owned ec
998  # ID: offset - : participating ec
999  # owned ec index = ID
1000  # participate ec index = ID - offset
1001  ecs = exec_context._narrow(RTC.ExecutionContextService)
1002  if CORBA.is_nil(ecs):
1003  return -1
1004 
1005  # if m_ecOther has nil element, insert attached ec to there.
1006  for i in range(len(self._ecOther)):
1007  if CORBA.is_nil(self._ecOther[i]):
1008  self._ecOther[i] = ecs
1009  ec_id = i + ECOTHER_OFFSET
1010  self.onAttachExecutionContext(ec_id)
1011  return ec_id
1012 
1013  # no space in the list, push back ec to the last.
1015  ec_id = long(len(self._ecOther) - 1 + ECOTHER_OFFSET)
1016  self.onAttachExecutionContext(ec_id)
1017  return ec_id
1018 
1019 
1020  # UniqueId bindContext(ExecutionContext_ptr exec_context);
1021  def bindContext(self, exec_context):
1022  global ECOTHER_OFFSET
1023  self._rtcout.RTC_TRACE("bindContext()")
1024  # ID: 0 - (offset-1) : owned ec
1025  # ID: offset - : participating ec
1026  # owned ec index = ID
1027  # participate ec index = ID - offset
1028  ecs = exec_context._narrow(RTC.ExecutionContextService)
1029 
1030  if CORBA.is_nil(ecs):
1031  return -1
1032 
1033  # if m_ecMine has nil element, insert attached ec to there.
1034  for i in range(len(self._ecMine)):
1035  if CORBA.is_nil(self._ecMine[i]):
1036  self._ecMine[i] = ecs
1037  self.onAttachExecutionContext(i)
1038  return i
1039  #return i + ECOTHER_OFFSET
1040 
1041  # no space in the list, push back ec to the last.
1043 
1044  return long(len(self._ecMine) - 1)
1045  #return long(len(self._ecMine) - 1 + ECOTHER_OFFSET)
1046 
1047 
1048 
1090  def detach_context(self, ec_id):
1091  global ECOTHER_OFFSET
1092  self._rtcout.RTC_TRACE("detach_context(%d)", ec_id)
1093  len_ = len(self._ecOther)
1094 
1095  # ID: 0 - (offset-1) : owned ec
1096  # ID: offset - : participating ec
1097  # owned ec index = ID
1098  # participate ec index = ID - offset
1099  if (long(ec_id) < long(ECOTHER_OFFSET)) or \
1100  (long(ec_id - ECOTHER_OFFSET) > len_):
1101  return RTC.BAD_PARAMETER
1102 
1103  index = long(ec_id - ECOTHER_OFFSET)
1104 
1105  if index < 0 or CORBA.is_nil(self._ecOther[index]):
1106  return RTC.BAD_PARAMETER
1107 
1108  #OpenRTM_aist.CORBA_SeqUtil.erase(self._ecOther, index)
1109  self._ecOther[index] = RTC.ExecutionContextService._nil
1110  self.onDetachExecutionContext(ec_id)
1111  return RTC.RTC_OK
1112 
1113 
1114 
1138  def on_initialize(self):
1139  self._rtcout.RTC_TRACE("on_initialize()")
1140  ret = RTC.RTC_ERROR
1141  try:
1142  self.preOnInitialize(0)
1143  ret = self.onInitialize()
1144  except:
1145  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1146  ret = RTC.RTC_ERROR
1147 
1148  active_set = self._properties.getProperty("configuration.active_config",
1149  "default")
1150 
1151  if self._configsets.haveConfig(active_set):
1152  self._configsets.update(active_set)
1153  else:
1154  self._configsets.update("default")
1155 
1156  self.postOnInitialize(0,ret)
1157  return ret
1158 
1159 
1160 
1184  def on_finalize(self):
1185  self._rtcout.RTC_TRACE("on_finalize()")
1186  ret = RTC.RTC_ERROR
1187  try:
1188  self.preOnFinalize(0)
1189  ret = self.onFinalize()
1190  except:
1191  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1192  ret = RTC.RTC_ERROR
1193  self.postOnFinalize(0, ret)
1194  return ret
1195 
1196 
1197 
1224  def on_startup(self, ec_id):
1225  self._rtcout.RTC_TRACE("on_startup(%d)", ec_id)
1226  ret = RTC.RTC_ERROR
1227  try:
1228  self.preOnStartup(ec_id)
1229  ret = self.onStartup(ec_id)
1230  except:
1231  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1232  ret = RTC.RTC_ERROR
1233  self.postOnStartup(ec_id, ret)
1234  return ret
1235 
1236 
1237 
1264  def on_shutdown(self, ec_id):
1265  self._rtcout.RTC_TRACE("on_shutdown(%d)", ec_id)
1266  ret = RTC.RTC_ERROR
1267  try:
1268  self.preOnShutdown(ec_id)
1269  ret = self.onShutdown(ec_id)
1270  except:
1271  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1272  ret = RTC.RTC_ERROR
1273  self.postOnShutdown(ec_id, ret)
1274  return ret
1275 
1276 
1277 
1302  def on_activated(self, ec_id):
1303  self._rtcout.RTC_TRACE("on_activated(%d)", ec_id)
1304  ret = RTC.RTC_ERROR
1305  try:
1306  self.preOnActivated(ec_id)
1307  self._configsets.update()
1308  ret = self.onActivated(ec_id)
1309  self._portAdmin.activatePorts()
1310  except:
1311  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1312  ret = RTC.RTC_ERROR
1313  self.postOnActivated(ec_id, ret)
1314  return ret
1315 
1316 
1317 
1342  def on_deactivated(self, ec_id):
1343  self._rtcout.RTC_TRACE("on_deactivated(%d)", ec_id)
1344  ret = RTC.RTC_ERROR
1345  try:
1346  self.preOnDeactivated(ec_id)
1347  self._portAdmin.deactivatePorts()
1348  ret = self.onDeactivated(ec_id)
1349  except:
1350  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1351  ret = RTC.RTC_ERROR
1352  self.postOnDeactivated(ec_id, ret)
1353  return ret
1354 
1355 
1356 
1387  def on_aborting(self, ec_id):
1388  self._rtcout.RTC_TRACE("on_aborting(%d)", ec_id)
1389  ret = RTC.RTC_ERROR
1390  try:
1391  self.preOnAborting(ec_id)
1392  ret = self.onAborting(ec_id)
1393  except:
1394  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1395  ret = RTC.RTC_ERROR
1396  self.postOnAborting(ec_id, ret)
1397  return ret
1398 
1399 
1400 
1442  def on_error(self, ec_id):
1443  self._rtcout.RTC_TRACE("on_error(%d)", ec_id)
1444  ret = RTC.RTC_ERROR
1445  try:
1446  self.preOnError(ec_id)
1447  ret = self.onError(ec_id)
1448  except:
1449  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1450  ret = RTC.RTC_ERROR
1451  self._configsets.update()
1452  self.postOnError(ec_id, ret)
1453  return ret
1454 
1455 
1456 
1488  def on_reset(self, ec_id):
1489  self._rtcout.RTC_TRACE("on_reset(%d)", ec_id)
1490  ret = RTC.RTC_ERROR
1491  try:
1492  self.preOnReset(ec_id)
1493  ret = self.onReset(ec_id)
1494  except:
1495  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1496  ret = RTC.RTC_ERROR
1497  self.postOnReset(ec_id, ret)
1498  return ret
1499 
1500 
1501 
1541  def on_execute(self, ec_id):
1542  self._rtcout.RTC_TRACE("on_execute(%d)", ec_id)
1543  ret = RTC.RTC_ERROR
1544  try:
1545  self.preOnExecute(ec_id)
1546  if self._readAll:
1547  self.readAll()
1548 
1549  ret = self.onExecute(ec_id)
1550 
1551  if self._writeAll:
1552  self.writeAll()
1553 
1554  except:
1555  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1556  ret = RTC.RTC_ERROR
1557  self.postOnExecute(ec_id, ret)
1558  return ret
1559 
1560 
1561 
1601  def on_state_update(self, ec_id):
1602  self._rtcout.RTC_TRACE("on_state_update(%d)", ec_id)
1603  ret = RTC.RTC_ERROR
1604  try:
1605  self.preOnStateUpdate(ec_id)
1606  ret = self.onStateUpdate(ec_id)
1607  self._configsets.update()
1608  except:
1609  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1610  ret = RTC.RTC_ERROR
1611  self.postOnStateUpdate(ec_id, ret)
1612  return ret
1613 
1614 
1615 
1649  def on_rate_changed(self, ec_id):
1650  self._rtcout.RTC_TRACE("on_rate_changed(%d)", ec_id)
1651  ret = RTC.RTC_ERROR
1652  try:
1653  self.preOnRateChanged(ec_id)
1654  ret = self.onRateChanged(ec_id)
1655  except:
1656  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1657  ret = RTC.RTC_ERROR
1658  self.postOnRateChanged(ec_id, ret)
1659  return ret
1660 
1661 
1662  #============================================================
1663  # SDOPackage::SdoSystemElement
1664  #============================================================
1665 
1666 
1707  self._rtcout.RTC_TRACE("get_owned_organizations()")
1708  try:
1709  return self._sdoOwnedOrganizations
1710  except:
1711  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1712  raise SDOPackage.NotAvailable("NotAvailable: get_owned_organizations")
1713 
1714  return []
1715 
1716 
1717  #============================================================
1718  # SDOPackage::SDO
1719  #============================================================
1720 
1721 
1757  def get_sdo_id(self):
1758  self._rtcout.RTC_TRACE("get_sdo_id()")
1759  try:
1760  return self._profile.instance_name
1761  except:
1762  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1763  raise SDOPackage.InternalError("get_sdo_id()")
1764 
1765 
1766 
1802  def get_sdo_type(self):
1803  self._rtcout.RTC_TRACE("get_sdo_type()")
1804  try:
1805  return self._profile.description
1806  except:
1807  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1808  raise SDOPackage.InternalError("get_sdo_type()")
1809  return ""
1810 
1811 
1812 
1852  self._rtcout.RTC_TRACE("get_device_profile()")
1853  try:
1854  return self._SdoConfigImpl.getDeviceProfile()
1855  except:
1856  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1857  raise SDOPackage.InternalError("get_device_profile()")
1858 
1859  return SDOPackage.DeviceProfile("","","","",[])
1860 
1861 
1862 
1902  self._rtcout.RTC_TRACE("get_service_profiles()")
1903  self._sdoSvcProfiles = self._SdoConfigImpl.getServiceProfiles()
1904  try:
1905  return self._sdoSvcProfiles
1906  except:
1907  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1908  raise SDOPackage.InternalError("get_service_profiles()")
1909 
1910  return []
1911 
1912 
1913 
1956  def get_service_profile(self, _id):
1957  self._rtcout.RTC_TRACE("get_service_profile(%s)", _id)
1958  self._sdoSvcProfiles = self._SdoConfigImpl.getServiceProfiles()
1959  if not _id:
1960  raise SDOPackage.InvalidParameter("get_service_profile(): Empty name.")
1961 
1962  try:
1964 
1965  if index < 0:
1966  raise SDOPackage.InvalidParameter("get_service_profile(): Not found")
1967 
1968  return self._sdoSvcProfiles[index]
1969  except:
1970  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1971  raise SDOPackage.InternalError("get_service_profile()")
1972 
1973  return SDOPackage.ServiceProfile("", "", [], None)
1974 
1975 
1976 
2023  def get_sdo_service(self, _id):
2024  self._rtcout.RTC_TRACE("get_sdo_service(%s)", _id)
2025  self._sdoSvcProfiles = self._SdoConfigImpl.getServiceProfiles()
2026 
2027  if not _id:
2028  raise SDOPackage.InvalidParameter("get_service(): Empty name.")
2029 
2031 
2032  if index < 0:
2033  raise SDOPackage.InvalidParameter("get_service(): Not found")
2034 
2035  try:
2036  return self._sdoSvcProfiles[index].service
2037  except:
2038  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
2039  raise SDOPackage.InternalError("get_service()")
2040  return SDOPackage.SDOService._nil
2041 
2042 
2043 
2090  self._rtcout.RTC_TRACE("get_configuration()")
2091  if self._SdoConfig is None:
2092  raise SODPackage.InterfaceNotImplemented("InterfaceNotImplemented: get_configuration")
2093  try:
2094  return self._SdoConfig
2095  except:
2096  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
2097  raise SDOPackage.InternalError("get_configuration()")
2098  return SDOPackage.Configuration._nil
2099 
2100 
2101 
2146  def get_monitoring(self):
2147  self._rtcout.RTC_TRACE("get_monitoring()")
2148  raise SDOPackage.InterfaceNotImplemented("Exception: get_monitoring")
2149  return SDOPackage.Monitoring._nil
2150 
2151 
2152 
2190  self._rtcout.RTC_TRACE("get_organizations()")
2191  self._sdoOrganizations = self._SdoConfigImpl.getOrganizations()
2192  try:
2193  return self._sdoOrganizations
2194  except:
2195  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
2196  raise SDOPackage.InternalError("get_organizations()")
2197  return []
2198 
2199 
2200 
2233  def get_status_list(self):
2234  self._rtcout.RTC_TRACE("get_status_list()")
2235  try:
2236  return self._sdoStatus
2237  except:
2238  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
2239  raise SDOPackage.InternalError("get_status_list()")
2240  return []
2241 
2242 
2243 
2280  def get_status(self, name):
2281  self._rtcout.RTC_TRACE("get_status(%s)", name)
2282  index = OpenRTM_aist.CORBA_SeqUtil.find(self._sdoStatus, self.nv_name(name))
2283  if index < 0:
2284  raise SDOPackage.InvalidParameter("get_status(): Not found")
2285 
2286  try:
2287  return any.to_any(self._sdoStatus[index].value)
2288  except:
2289  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
2290  raise SDOPackage.InternalError("get_status()")
2291  return any.to_any("")
2292 
2293 
2294  #============================================================
2295  # Local interfaces
2296  #============================================================
2297 
2298 
2313  def getInstanceName(self):
2314  self._rtcout.RTC_TRACE("getInstanceName()")
2315  return self._profile.instance_name
2316 
2317 
2318 
2333  def setInstanceName(self, instance_name):
2334  self._rtcout.RTC_TRACE("setInstanceName(%s)", instance_name)
2335  self._properties.setProperty("instance_name",instance_name)
2336  self._profile.instance_name = self._properties.getProperty("instance_name")
2337 
2338 
2339 
2354  def getTypeName(self):
2355  self._rtcout.RTC_TRACE("getTypeName()")
2356  return self._profile.type_name
2357 
2358 
2359 
2374  def getDescription(self):
2375  self._rtcout.RTC_TRACE("getDescription()")
2376  return self._profile.description
2377 
2378 
2379 
2394  def getVersion(self):
2395  self._rtcout.RTC_TRACE("getVersion()")
2396  return self._profile.version
2397 
2398 
2399 
2414  def getVendor(self):
2415  self._rtcout.RTC_TRACE("getVendor()")
2416  return self._profile.vendor
2417 
2418 
2419 
2434  def getCategory(self):
2435  self._rtcout.RTC_TRACE("getCategory()")
2436  return self._profile.category
2437 
2438 
2439 
2454  def getNamingNames(self):
2455  self._rtcout.RTC_TRACE("getNamingNames()")
2456  return [s.strip() for s in self._properties.getProperty("naming.names").split(",")]
2457 
2458 
2459 
2473  def setObjRef(self, rtobj):
2474  self._rtcout.RTC_TRACE("setObjRef()")
2475  self._objref = rtobj
2476  return
2477 
2478 
2479 
2494  def getObjRef(self):
2495  self._rtcout.RTC_TRACE("getObjRef()")
2496  return self._objref
2497 
2498 
2499 
2525  def setProperties(self, prop):
2526  self._rtcout.RTC_TRACE("setProperties()")
2527  self._properties.mergeProperties(prop)
2528  self._profile.instance_name = self._properties.getProperty("instance_name")
2529  self._profile.type_name = self._properties.getProperty("type_name")
2530  self._profile.description = self._properties.getProperty("description")
2531  self._profile.version = self._properties.getProperty("version")
2532  self._profile.vendor = self._properties.getProperty("vendor")
2533  self._profile.category = self._properties.getProperty("category")
2534 
2535 
2536 
2559  def getProperties(self):
2560  self._rtcout.RTC_TRACE("getProperties()")
2561  return self._properties
2562 
2563 
2564 
2587  def bindParameter(self, param_name, var, def_val, trans=None):
2588  self._rtcout.RTC_TRACE("bindParameter()")
2589  if trans is None:
2590  trans_ = OpenRTM_aist.stringTo
2591  else:
2592  trans_ = trans
2593  self._configsets.bindParameter(param_name, var, def_val, trans_)
2594  return True
2595 
2596 
2597 
2612  def updateParameters(self, config_set):
2613  self._rtcout.RTC_TRACE("updateParameters(%s)", config_set)
2614  self._configsets.update(config_set)
2615  return
2616 
2617 
2618 
2652  def registerPort(self, port):
2653  self._rtcout.RTC_TRACE("registerPort()")
2654  if not self.addPort(port):
2655  self._rtcout.RTC_ERROR("addPort(PortBase&) failed.")
2656  return
2657 
2658  # void registerPort(PortService_ptr port);
2659  # def registerPortByReference(self, port_ref):
2660  # self._rtcout.RTC_TRACE("registerPortByReference()")
2661  # self.addPortByReference(port_ref)
2662  # return
2663 
2664  # new interface. since 1.0.0-RELEASE
2665  # void addPort(PortBase& port);
2666  def addPort(self, port):
2667  self._rtcout.RTC_TRACE("addPort()")
2668  if isinstance(port, OpenRTM_aist.CorbaPort):
2669  self._rtcout.RTC_TRACE("addPort(CorbaPort)")
2670  propkey = "port.corbaport."
2671  prop = self._properties.getNode(propkey)
2672  if prop:
2673  self._properties.getNode(propkey).mergeProperties(self._properties.getNode("port.corba"))
2674  port.init(self._properties.getNode(propkey))
2675  port.setOwner(self.getObjRef())
2676 
2677  elif isinstance(port, OpenRTM_aist.PortBase):
2678  self._rtcout.RTC_TRACE("addPort(PortBase)")
2679  port.setOwner(self.getObjRef())
2680  port.setPortConnectListenerHolder(self._portconnListeners)
2681  self.onAddPort(port.getPortProfile())
2682 
2683  elif isinstance(port, RTC._objref_PortService):
2684  self._rtcout.RTC_TRACE("addPort(PortService)")
2685  return self._portAdmin.addPort(port)
2686 
2687 
2688  # new interface. since 1.0.0-RELEASE
2689  # void addPort(PortService_ptr port);
2690  # def addPortByReference(self, port_ref):
2691  # self._rtcout.RTC_TRACE("addPortByReference()")
2692  # self._portAdmin.registerPortByReference(port_ref)
2693  # return
2694 
2695 
2696 
2713  def registerInPort(self, name, inport):
2714  self._rtcout.RTC_TRACE("registerInPort(%s)", name)
2715  if not self.addInPort(name, inport):
2716  self._rtcout.RTC_ERROR("addInPort(%s) failed.", name)
2717  return
2718 
2719  # new interface. since 1.0.0-RELEASE
2720  def addInPort(self, name, inport):
2721  self._rtcout.RTC_TRACE("addInPort(%s)", name)
2722 
2723  propkey = "port.inport." + name
2724  prop_ = copy.copy(self._properties.getNode(propkey))
2725  prop_.mergeProperties(self._properties.getNode("port.inport.dataport"))
2726 
2727  ret = self.addPort(inport)
2728 
2729  if not ret:
2730  self._rtcout.RTC_ERROR("addInPort() failed.")
2731  return ret
2732 
2733  inport.init(self._properties.getNode(propkey))
2734  self._inports.append(inport)
2735  return ret
2736 
2737 
2738 
2756  def registerOutPort(self, name, outport):
2757  self._rtcout.RTC_TRACE("registerOutPort(%s)", name)
2758  if not self.addOutPort(name, outport):
2759  self._rtcout.RTC_ERROR("addOutPort(%s) failed.", name)
2760  return
2761 
2762  # new interface. since 1.0.0-RELEASE
2763  # void addOutPort(const char* name, OutPortBase& outport);
2764  def addOutPort(self, name, outport):
2765  self._rtcout.RTC_TRACE("addOutPort(%s)", name)
2766 
2767  propkey = "port.outport." + name
2768  prop_ = copy.copy(self._properties.getNode(propkey))
2769  prop_.mergeProperties(self._properties.getNode("port.outport.dataport"))
2770 
2771  ret = self.addPort(outport)
2772 
2773  if not ret:
2774  self._rtcout.RTC_ERROR("addOutPort() failed.")
2775  return ret
2776 
2777  outport.init(self._properties.getNode(propkey))
2778  self._outports.append(outport)
2779  return ret
2780 
2781 
2782 
2804  def removeInPort(self, port):
2805  self._rtcout.RTC_TRACE("removeInPort()")
2806  ret = self.removePort(inport)
2807 
2808  if ret:
2809  for inport in self._inports:
2810  if port == inport:
2811  try:
2812  self._inports.remove(port)
2813  except:
2814  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
2815 
2816  return True
2817 
2818  return False
2819 
2820 
2821 
2843  def removeOutPort(self, port):
2844  self._rtcout.RTC_TRACE("removeOutPort()")
2845  ret = self.removePort(outport)
2846 
2847  if ret:
2848  for outport in self._outports:
2849  if port == outport:
2850  try:
2851  self._outports.remove(port)
2852  except:
2853  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
2854 
2855  return True
2856 
2857  return False
2858 
2859 
2860 
2880  def deletePort(self, port):
2881  self._rtcout.RTC_TRACE("deletePort()")
2882  if not self.removePort(port):
2883  self._rtcout.RTC_ERROR("removePort() failed.")
2884  return
2885 
2886  # new interface. since 1.0.0-RELEASE
2887  def removePort(self, port):
2888  self._rtcout.RTC_TRACE("removePort()")
2889  if isinstance(port, OpenRTM_aist.PortBase) or isinstance(port, OpenRTM_aist.CorbaPort):
2890  self.onRemovePort(port.getPortProfile())
2891  return self._portAdmin.removePort(port)
2892 
2893 
2894 
2907  def deletePortByName(self, port_name):
2908  self._rtcout.RTC_TRACE("deletePortByName(%s)", port_name)
2909  self._portAdmin.deletePortByName(port_name)
2910  return
2911 
2912 
2913 
2964  def getExecutionContext(self, ec_id):
2965  return self.get_context(ec_id)
2966 
2967 
3020  def getExecutionRate(self, ec_id):
3021  ec = self.getExecutionContext(ec_id)
3022  if CORBA.is_nil(ec):
3023  return 0.0
3024 
3025  return ec.get_rate()
3026 
3027 
3028 
3082  def setExecutionRate(self, ec_id, rate):
3083  ec = self.getExecutionContext(ec_id)
3084  if CORBA.is_nil(ec):
3085  return RTC.RTC_ERROR
3086  ec.set_rate(rate)
3087  return RTC.RTC_OK
3088 
3089 
3090 
3143  def isOwnExecutionContext(self, ec_id):
3144  global ECOTHER_OFFSET
3145  if ec_id < ECOTHER_OFFSET:
3146  return True
3147  return False
3148 
3149 
3150 
3189  def deactivate(self, ec_id):
3190  ec = self.getExecutionContext(ec_id)
3191  if CORBA.is_nil(ec):
3192  return RTC.RTC_ERROR
3193  return ec.deactivate_component(self.getObjRef())
3194 
3195 
3196 
3233  def activate(self, ec_id):
3234  ec = self.getExecutionContext(ec_id)
3235  if CORBA.is_nil(ec):
3236  return RTC.RTC_ERROR
3237  return ec.activate_component(self.getObjRef())
3238 
3239 
3240 
3275  def reset(self, ec_id):
3276  ec = self.getExecutionContext(ec_id)
3277  if CORBA.is_nil(ec):
3278  return RTC.RTC_ERROR
3279  return ec.reset_component(self.getObjRef())
3280 
3281 
3282 
3291  def addSdoServiceProvider(self, prof, provider):
3292  return self._sdoservice.addSdoServiceProvider(prof, provider)
3293 
3294 
3295 
3303  def removeSdoServiceProvider(self, id):
3304  return self._sdoservice.removeSdoServiceProvider(id)
3305 
3306 
3307 
3315  def addSdoServiceConsumer(self, prof):
3316  return self._sdoservice.addSdoServiceConsumer(prof)
3317 
3318 
3319 
3327  def removeSdoServiceConsumer(self, id):
3328  return self._sdoservice.removeSdoServiceConsumer(id)
3329 
3330 
3331 
3352  def readAll(self):
3353  self._rtcout.RTC_TRACE("readAll()")
3354  ret = True
3355  for inport in self._inports:
3356  if not inport.read():
3357  self._rtcout.RTC_DEBUG("The error occurred in readAll().")
3358  ret = False
3359  if not self._readAllCompletion:
3360  return False
3361 
3362  return ret
3363 
3364 
3365 
3386  def writeAll(self):
3387  self._rtcout.RTC_TRACE("writeAll()")
3388  ret = True
3389  for outport in self._outports:
3390  if not outport.write():
3391  self._rtcout.RTC_DEBUG("The error occurred in writeAll().")
3392  ret = False
3393  if not self._writeAllCompletion:
3394  return False
3395 
3396  return ret
3397 
3398 
3399 
3433  def setReadAll(self, read=True, completion=False):
3434  self._readAll = read
3435  self._readAllCompletion = completion
3436 
3437 
3438 
3470  def setWriteAll(self, write=True, completion=False):
3471  self._writeAll = write
3472  self._writeAllCompletion = completion
3473 
3474 
3475 
3492  def finalizePorts(self):
3493  self._rtcout.RTC_TRACE("finalizePorts()")
3494  self._portAdmin.finalizePorts()
3495  self._inports = []
3496  self._outports = []
3497  return
3498 
3499 
3500  def finalizeContexts(self):
3501  self._rtcout.RTC_TRACE("finalizeContexts()")
3502  len_ = len(self._eclist)
3503  for i in range(len_):
3504  idx = (len_ - 1) - i
3505  self._eclist[idx].stop()
3506  try:
3507  self._poa.deactivate_object(self._poa.servant_to_id(self._eclist[idx]))
3508  except:
3509  self._rtcout.RTC_TRACE(OpenRTM_aist.Logger.print_exception())
3510  del self._eclist[idx]
3511 
3512  if self._eclist:
3513  self._eclist = []
3514  return
3515 
3516 
3517 
3594  def addPreComponentActionListener(self, listener_type, memfunc, autoclean = True):
3596  def __init__(self, memfunc):
3597  self._memfunc = memfunc
3598 
3599  def __call__(self, ec_id):
3600  self._memfunc(ec_id)
3601  return
3602 
3603  listener = Noname(memfunc)
3604  self._actionListeners.preaction_[listener_type].addListener(listener, autoclean)
3605  return listener
3606 
3607 
3608 
3630  def removePreComponentActionListener(self, listener_type, listener):
3631  self._actionListeners.preaction_[listener_type].removeListener(listener)
3632  return
3633 
3634 
3635 
3713  def addPostComponentActionListener(self, listener_type, memfunc, autoclean = True):
3715  def __init__(self, memfunc):
3716  self._memfunc = memfunc
3717  return
3718  def __call__(self, ec_id, ret):
3719  self._memfunc(ec_id, ret)
3720  return
3721 
3722  listener = Noname(memfunc)
3723  self._actionListeners.postaction_[listener_type].addListener(listener, autoclean)
3724  return listener
3725 
3726 
3727 
3749  def removePostComponentActionListener(self, listener_type, listener):
3750  self._actionListeners.postaction_[listener_type].removeListener(listener)
3751  return
3753 
3754 
3812  def addPortActionListener(self, listener_type, memfunc, autoclean = True):
3813  class Noname(OpenRTM_aist.PortActionListener):
3814  def __init__(self, memfunc):
3815  self._memfunc = memfunc
3816  return
3817 
3818  def __call__(self, pprofile):
3819  self._memfunc(pprofile)
3820  return
3821 
3822  listener = Noname(memfunc)
3823  self._actionListeners.portaction_[listener_type].addListener(listener, autoclean)
3824  return listener
3825 
3826 
3827 
3848  def removePortActionListener(self, listener_type, listener):
3849  self._actionListeners.portaction_[listener_type].removeListener(listener)
3850  return
3851 
3853 
3911  def addExecutionContextActionListener(self, listener_type, memfunc, autoclean = True):
3913  def __init__(self, memfunc):
3914  self._memfunc = memfunc
3915  return
3917  def __call__(self, ec_id):
3918  self._memfunc(ec_id)
3919  return
3920 
3921  listener = Noname(memfunc)
3922  self._actionListeners.ecaction_[listener_type].addListener(listener, autoclean)
3923  return listener
3924 
3925 
3926 
3948  def removeExecutionContextActionListener(self, listener_type, listener):
3949  self._actionListeners.ecaction_[listener_type].removeListener(listener)
3950  return
3951 
3952 
4013  def addPortConnectListener(self, listener_type, memfunc, autoclean = True):
4014  class Noname(OpenRTM_aist.PortConnectListener):
4015  def __init__(self, memfunc):
4016  self._memfunc = memfunc
4017  return
4018 
4019  def __call__(self, portname, cprofile):
4020  self._memfunc(portname, cprofile)
4021  return
4022 
4023  listener = Noname(memfunc)
4024  self._portconnListeners.portconnect_[listener_type].addListener(listener, autoclean)
4025  return listener
4026 
4027 
4028 
4050  def removePortConnectListener(self, listener_type, listener):
4051  self._portconnListeners.portconnect_[listener_type].removeListener(listener)
4052  return
4053 
4054 
4055 
4119  def addPortConnectRetListener(self, listener_type, memfunc, autoclean = True):
4121  def __init__(self, memfunc):
4122  self._memfunc = memfunc
4123  return
4124 
4125  def __call__(self, portname, cprofile, ret):
4126  self._memfunc(portname, cprofile, ret)
4127  return
4128 
4129  listener = Noname(memfunc)
4130  self._portconnListeners.portconnret_[listener_type].addListener(listener, autoclean)
4131  return listener
4132 
4133 
4134 
4156  def removePortConnectRetListener(self, listener_type, listener):
4157  self._portconnListeners.portconnret_[listener_type].removeListener(listener)
4158  return
4159 
4160 
4161 
4199  def addConfigurationParamListener(self, type, memfunc, autoclean = True):
4201  def __init__(self, memfunc):
4202  self._memfunc = memfunc
4203  return
4204 
4205  def __call__(self, config_set_name, config_param_name):
4206  self._memfunc(config_set_name, config_param_name)
4207  return
4208 
4209  listener = Noname(memfunc)
4210  self._configsets.addConfigurationParamListener(type, listener, autoclean)
4211  return listener
4212 
4213 
4214 
4240  def removeConfigurationParamListener(self, type, listener):
4241  self._configsets.removeConfigurationParamListener(type, listener)
4242  return
4243 
4244 
4245 
4281  def addConfigurationSetListener(self, listener_type, memfunc, autoclean = True):
4283  def __init__(self, memfunc):
4284  self._memfunc = memfunc
4285  return
4286 
4287  def __call__(self, config_set):
4288  self._memfunc(config_set)
4289  return
4291  listener = Noname(memfunc)
4292  self._configsets.addConfigurationSetListener(listener_type, listener, autoclean)
4293  return listener
4294 
4295 
4296 
4320  def removeConfigurationSetListener(self, type, listener):
4321  self._configsets.removeConfigurationSetListener(type, listener)
4322  return
4323 
4324 
4325 
4363  def addConfigurationSetNameListener(self, type, memfunc, autoclean = True):
4365  def __init__(self, memfunc):
4366  self._memfunc = memfunc
4367  return
4368 
4369  def __call__(self, config_set_name):
4370  self._memfunc(config_set_name)
4371  return
4373  listener = Noname(memfunc)
4374  self._configsets.addConfigurationSetNameListener(type, listener, autoclean)
4375  return listener
4376 
4377 
4378 
4406  def removeConfigurationSetNameListener(self, type, listener):
4407  self._configsets.removeConfigurationSetNameListener(type, listener)
4408  return
4409 
4410 
4411 
4425  def shutdown(self):
4426  self._rtcout.RTC_TRACE("shutdown()")
4427  try:
4428  self.finalizePorts()
4429  self.finalizeContexts()
4430  self._poa.deactivate_object(self._poa.servant_to_id(self._SdoConfigImpl))
4431  self._poa.deactivate_object(self._poa.servant_to_id(self))
4432  except:
4433  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
4435  if self._manager:
4436  self._rtcout.RTC_DEBUG("Cleanup on Manager")
4437  self._manager.notifyFinalized(self)
4438 
4439  return
4440 
4441  # inline void preOnInitialize(UniqueId ec_id)
4442  def preOnInitialize(self, ec_id):
4443  self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_INITIALIZE].notify(ec_id)
4444  return
4445 
4446  # inline void preOnFinalize(UniqueId ec_id)
4447  def preOnFinalize(self, ec_id):
4448  self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_FINALIZE].notify(ec_id)
4449  return
4450 
4451  # inline void preOnStartup(UniqueId ec_id)
4452  def preOnStartup(self, ec_id):
4453  self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_STARTUP].notify(ec_id)
4454  return
4455 
4456  # inline void preOnShutdown(UniqueId ec_id)
4457  def preOnShutdown(self, ec_id):
4458  self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_SHUTDOWN].notify(ec_id)
4459  return
4460 
4461  # inline void preOnActivated(UniqueId ec_id)
4462  def preOnActivated(self, ec_id):
4463  self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_ACTIVATED].notify(ec_id)
4464  return
4465 
4466  # inline void preOnDeactivated(UniqueId ec_id)
4467  def preOnDeactivated(self, ec_id):
4468  self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_DEACTIVATED].notify(ec_id)
4469  return
4470 
4471  # inline void preOnAborting(UniqueId ec_id)
4472  def preOnAborting(self, ec_id):
4473  self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_ABORTING].notify(ec_id)
4474  return
4475 
4476  # inline void preOnError(UniqueId ec_id)
4477  def preOnError(self, ec_id):
4478  self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_ERROR].notify(ec_id)
4479  return
4480 
4481  # inline void preOnReset(UniqueId ec_id)
4482  def preOnReset(self, ec_id):
4483  self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_RESET].notify(ec_id)
4484  return
4485 
4486  # inline void preOnExecute(UniqueId ec_id)
4487  def preOnExecute(self, ec_id):
4488  self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_EXECUTE].notify(ec_id)
4489  return
4490 
4491  # inline void preOnStateUpdate(UniqueId ec_id)
4492  def preOnStateUpdate(self, ec_id):
4493  self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_STATE_UPDATE].notify(ec_id)
4494  return
4495 
4497  # inline void preOnRateChanged(UniqueId ec_id)
4498  def preOnRateChanged(self, ec_id):
4499  self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_RATE_CHANGED].notify(ec_id)
4500  return
4502 
4503  # inline void postOnInitialize(UniqueId ec_id, ReturnCode_t ret)
4504  def postOnInitialize(self, ec_id, ret):
4505  self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_INITIALIZE].notify(ec_id, ret)
4506  return
4508 
4509  # inline void postOnFinalize(UniqueId ec_id, ReturnCode_t ret)
4510  def postOnFinalize(self, ec_id, ret):
4511  self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_FINALIZE].notify(ec_id, ret)
4512  return
4514 
4515  # inline void postOnStartup(UniqueId ec_id, ReturnCode_t ret)
4516  def postOnStartup(self, ec_id, ret):
4517  self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_STARTUP].notify(ec_id, ret)
4518  return
4520 
4521  # inline void postOnShutdown(UniqueId ec_id, ReturnCode_t ret)
4522  def postOnShutdown(self, ec_id, ret):
4523  self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_SHUTDOWN].notify(ec_id, ret)
4524  return
4526 
4527  # inline void postOnActivated(UniqueId ec_id, ReturnCode_t ret)
4528  def postOnActivated(self, ec_id, ret):
4529  self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_ACTIVATED].notify(ec_id, ret)
4530  return
4532 
4533  # inline void postOnDeactivated(UniqueId ec_id, ReturnCode_t ret)
4534  def postOnDeactivated(self, ec_id, ret):
4535  self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_DEACTIVATED].notify(ec_id, ret)
4536  return
4538 
4539  # inline void postOnAborting(UniqueId ec_id, ReturnCode_t ret)
4540  def postOnAborting(self, ec_id, ret):
4541  self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_ABORTING].notify(ec_id, ret)
4542  return
4544 
4545  # inline void postOnError(UniqueId ec_id, ReturnCode_t ret)
4546  def postOnError(self, ec_id, ret):
4547  self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_ERROR].notify(ec_id, ret)
4548  return
4550 
4551  # inline void postOnReset(UniqueId ec_id, ReturnCode_t ret)
4552  def postOnReset(self, ec_id, ret):
4553  self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_RESET].notify(ec_id, ret)
4554  return
4556 
4557  # inline void postOnExecute(UniqueId ec_id, ReturnCode_t ret)
4558  def postOnExecute(self, ec_id, ret):
4559  self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_EXECUTE].notify(ec_id, ret)
4560  return
4562 
4563  # inline void postOnStateUpdate(UniqueId ec_id, ReturnCode_t ret)
4564  def postOnStateUpdate(self, ec_id, ret):
4565  self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_STATE_UPDATE].notify(ec_id, ret)
4566  return
4568 
4569  # inline void postOnRateChanged(UniqueId ec_id, ReturnCode_t ret)
4570  def postOnRateChanged(self, ec_id, ret):
4571  self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_RATE_CHANGED].notify(ec_id, ret)
4572  return
4574 
4575  # inline void onAddPort(const PortProfile& pprof)
4576  def onAddPort(self, pprof):
4577  self._actionListeners.portaction_[OpenRTM_aist.PortActionListenerType.ADD_PORT].notify(pprof)
4578  return
4580 
4581  # inline void onRemovePort(const PortProfile& pprof)
4582  def onRemovePort(self, pprof):
4583  self._actionListeners.portaction_[OpenRTM_aist.PortActionListenerType.REMOVE_PORT].notify(pprof)
4584  return
4586 
4587  # inline void onAttachExecutionContext(UniqueId ec_id)
4588  def onAttachExecutionContext(self, ec_id):
4589  self._actionListeners.ecaction_[OpenRTM_aist.ExecutionContextActionListenerType.EC_ATTACHED].notify(ec_id)
4590  return
4592 
4593  # inline void onDetachExecutionContext(UniqueId ec_id)
4594  def onDetachExecutionContext(self, ec_id):
4595  self._actionListeners.ecaction_[OpenRTM_aist.ExecutionContextActionListenerType.EC_DETACHED].notify(ec_id)
4596  return
4598 
4599 
4607  class svc_name:
4608  def __init__(self, _id):
4609  self._id= _id
4610 
4611  def __call__(self, prof):
4612  return self._id == prof.id
4613 
4614 
4615  #------------------------------------------------------------
4616  # Functor
4617  #------------------------------------------------------------
4619 
4626  class nv_name:
4627  def __init__(self, _name):
4628  self._name = _name
4629 
4630  def __call__(self, nv):
4631  return self._name == nv.name
4632 
4633 
4634 
4641  class ec_find:
4642  def __init__(self, _ec):
4643  self._ec = _ec
4644 
4645  def __call__(self, ecs):
4646  try:
4647  if not CORBA.is_nil(ecs):
4648  ec = ecs._narrow(RTC.ExecutionContext)
4649  return self._ec._is_equivalent(ec)
4650  except:
4651  print OpenRTM_aist.Logger.print_exception()
4652  return False
4653 
4654  return False
4655 
4656 
4657 
4664  class ec_copy:
4665  def __init__(self, eclist):
4666  self._eclist = eclist
4667 
4668  def __call__(self, ecs):
4669  if not CORBA.is_nil(ecs):
4670  self._eclist.append(ecs)
4671 
4672 
4680  class deactivate_comps:
4681  def __init__(self, comp):
4682  self._comp = comp
4683 
4684  def __call__(self, ec):
4685  try:
4686  if not CORBA.is_nil(ec) and not ec._non_existent():
4687  ec.deactivate_component(self._comp)
4688  ec.stop()
4689  except:
4690  print OpenRTM_aist.Logger.print_exception()
4692 
4693 # RtcBase = RTObject_impl
4694 
def get_status(self, name)
[SDO interface] Get SDO Status
Definition: RTObject.py:2280
def setReadAll(self, read=True, completion=False)
Set whether to execute the readAll() method.
Definition: RTObject.py:3434
def removePortConnectRetListener(self, listener_type, listener)
Removing PortConnectRet type listener.
Definition: RTObject.py:4163
def bindContext(self, exec_context)
Definition: RTObject.py:1021
def removeExecutionContextActionListener(self, listener_type, listener)
Removing ExecutionContextAction type listener.
Definition: RTObject.py:3953
def on_activated(self, ec_id)
[ComponentAction CORBA interface] Activate RTC
Definition: RTObject.py:1302
def on_finalize(self)
[ComponentAction CORBA interface] Finalize RTC
Definition: RTObject.py:1184
def postOnExecute(self, ec_id, ret)
Definition: RTObject.py:4567
def removePostComponentActionListener(self, listener_type, listener)
Removing PostComponentAction type listener.
Definition: RTObject.py:3752
def addSdoServiceProvider(self, prof, provider)
[local interface] Set a SDO service providerbool addSdoServiceProvider(const SDOPackage::ServiceProfi...
Definition: RTObject.py:3292
def getNamingNames(self)
std::vector<std::string> getNamingNames();
Definition: RTObject.py:2454
def getInstanceName(self)
const char* getInstanceName()
Definition: RTObject.py:2313
def reset(self, ec_id)
[local interface] Resetting and go to Inactive state
Definition: RTObject.py:3276
def initialize(self)
Initialize the RTC that realizes this interface.
Definition: RTObject.py:487
def onDetachExecutionContext(self, ec_id)
Definition: RTObject.py:4603
def postOnStartup(self, ec_id, ret)
Definition: RTObject.py:4525
def get_service_profiles(self)
[SDO interface] Getting SDO ServiceProfile
Definition: RTObject.py:1901
RT Conponent CORBA service/consumer Port.
Definition: CorbaPort.py:604
def deactivate(self, ec_id)
[local interface] Make transition to Inactive state
Definition: RTObject.py:3190
def registerOutPort(self, name, outport)
void registerOutPort(const char* name, OutPortBase& outport);
Definition: RTObject.py:2757
def removePortActionListener(self, listener_type, listener)
Removing PortAction type listener.
Definition: RTObject.py:3852
def get_sdo_service(self, _id)
[SDO interface] Getting specified SDO Service&#39;s reference
Definition: RTObject.py:2023
def addPortConnectRetListener(self, listener_type, memfunc, autoclean=True)
Adding PortConnectRet type listener.
Definition: RTObject.py:4126
def setWriteAll(self, write=True, completion=False)
Set whether to execute the writeAll() method.
Definition: RTObject.py:3471
def split(input, delimiter)
Split string by delimiter.
Definition: StringUtil.py:323
def push_back(seq, elem)
Push the new element back to the CORBA sequence.
def on_reset(self, ec_id)
[ComponentAction CORBA interface] Resetting RTC
Definition: RTObject.py:1488
def deletePortByName(self, port_name)
Definition: RTObject.py:2908
def getCategory(self)
const char* getCategory()
Definition: RTObject.py:2434
def getDescription(self)
const char* getDescription()
Definition: RTObject.py:2374
def addConfigurationSetNameListener(self, type, memfunc, autoclean=True)
Adding ConfigurationSetNameListener.
Definition: RTObject.py:4372
Configuration implementation class.
def addConfigurationSetListener(self, listener_type, memfunc, autoclean=True)
Adding ConfigurationSetListener.
Definition: RTObject.py:4290
def isOwnExecutionContext(self, ec_id)
[local interface] Checking if the current context is own context
Definition: RTObject.py:3144
def for_each(seq, f)
Apply the functor to all CORBA sequence elements.
def bindParameter(self, param_name, var, def_val, trans=None)
template <typename vartype>=""> bool bindParameter(const char* param_name, VarType& var...
Definition: RTObject.py:2588
def finalize(self)
Finalize the RTC for preparing it for destruction.
Definition: RTObject.py:570
def removeConfigurationParamListener(self, type, listener)
Removing ConfigurationParamListener.
Definition: RTObject.py:4248
The Properties class represents a persistent set of properties.
Definition: Properties.py:83
def getObjRef(self)
RTObject_ptr getObjRef() const;.
Definition: RTObject.py:2494
def on_error(self, ec_id)
[ComponentAction CORBA interface] Error Processing of RTC
Definition: RTObject.py:1442
def removeSdoServiceConsumer(self, id)
[local interface] Remove a SDO service consumerbool removeSdoServiceConsumer(const char* id); ...
Definition: RTObject.py:3328
def on_shutdown(self, ec_id)
[ComponentAction CORBA interface] ShutDown RTC
Definition: RTObject.py:1264
def addSdoServiceConsumer(self, prof)
[local interface] Set a SDO service consumerbool addSdoServiceConsumer(const SDOPackage::ServiceProfi...
Definition: RTObject.py:3316
def get_sdo_id(self)
[SDO interface] Getting SDO ID
Definition: RTObject.py:1757
def is_alive(self, exec_context)
Confirm whether RTC is an Alive state or NOT.
Definition: RTObject.py:698
def addConfigurationParamListener(self, type, memfunc, autoclean=True)
Adding ConfigurationParamListener.
Definition: RTObject.py:4207
def deletePort(self, port)
[local interface] Unregister Port
Definition: RTObject.py:2881
def activate(self, ec_id)
[local interface] Make transition to Active state
Definition: RTObject.py:3234
def get_sdo_type(self)
[SDO interface] Getting SDO type
Definition: RTObject.py:1802
def __del__(self)
destructor
Definition: RTObject.py:149
def setInstanceName(self, instance_name)
void setInstanceName(const char* instance_name);
Definition: RTObject.py:2333
def addPortActionListener(self, listener_type, memfunc, autoclean=True)
Adding PortAction type listener.
Definition: RTObject.py:3816
def get_status_list(self)
[SDO interface] Get SDO Status
Definition: RTObject.py:2233
def get_owned_organizations(self)
[SDO interface] Getting Organizations
Definition: RTObject.py:1706
def __init__(self, manager=None, orb=None, poa=None)
Consructor.
Definition: RTObject.py:91
def on_deactivated(self, ec_id)
[ComponentAction CORBA interface] Deactivate RTC
Definition: RTObject.py:1342
def removeConfigurationSetListener(self, type, listener)
Removing ConfigurationSetListener.
Definition: RTObject.py:4329
def on_startup(self, ec_id)
[ComponentAction CORBA interface] StartUp RTC
Definition: RTObject.py:1224
def get_context(self, ec_id)
[CORBA interface] Get ExecutionContextList.
Definition: RTObject.py:764
def postOnShutdown(self, ec_id, ret)
Definition: RTObject.py:4531
def addExecutionContextActionListener(self, listener_type, memfunc, autoclean=True)
Adding ExecutionContextAction type listener.
Definition: RTObject.py:3916
def getVendor(self)
const char* getVendor()
Definition: RTObject.py:2414
def writeAll(self)
The write() method of all OutPort is called.
Definition: RTObject.py:3387
def onAttachExecutionContext(self, ec_id)
Definition: RTObject.py:4597
def setProperties(self, prop)
[local interface] Set RTC property
Definition: RTObject.py:2525
def removePortConnectListener(self, listener_type, listener)
Removing PortConnect type listener.
Definition: RTObject.py:4056
def get_ports(self)
[RTObject CORBA interface] Get Ports
Definition: RTObject.py:949
def get_participating_contexts(self)
[CORBA interface] Get participating ExecutionContextList.
Definition: RTObject.py:827
def detach_context(self, ec_id)
[CORBA interface] Attach ExecutionContext.
Definition: RTObject.py:1090
def getExecutionContext(self, ec_id)
[local interface] Getting current execution context
Definition: RTObject.py:2965
def readAll(self)
Readout the value from All InPorts.
Definition: RTObject.py:3353
def addOutPort(self, name, outport)
Definition: RTObject.py:2765
def removeSdoServiceProvider(self, id)
[local interface] Remove a SDO service providerbool removeSdoServiceProvider(const char* id); ...
Definition: RTObject.py:3304
def get_configuration(self)
[SDO interface] Getting Configuration object
Definition: RTObject.py:2089
def get_service_profile(self, _id)
[SDO interface] Getting Organizations
Definition: RTObject.py:1956
def addInPort(self, name, inport)
Definition: RTObject.py:2721
def postOnInitialize(self, ec_id, ret)
Definition: RTObject.py:4513
def setExecutionRate(self, ec_id, rate)
[local interface] Setting current context&#39; execution rate
Definition: RTObject.py:3083
def get_organizations(self)
[SDO interface] Getting Organizations
Definition: RTObject.py:2189
def finalizePorts(self)
Unregister the All Portse.
Definition: RTObject.py:3493
def postOnAborting(self, ec_id, ret)
Definition: RTObject.py:4549
def exit(self)
Stop the RTC&#39;s execution context(s) and finalize it along with its contents.
Definition: RTObject.py:633
def removePreComponentActionListener(self, listener_type, listener)
Removing PreComponentAction type listener.
Definition: RTObject.py:3632
def registerInPort(self, name, inport)
Definition: RTObject.py:2714
def on_aborting(self, ec_id)
[ComponentAction CORBA interface] Transition Error State
Definition: RTObject.py:1387
def getTypeName(self)
const char* getTypeName()
Definition: RTObject.py:2354
def removeConfigurationSetNameListener(self, type, listener)
Removing ConfigurationSetNameListener.
Definition: RTObject.py:4415
def addPreComponentActionListener(self, listener_type, memfunc, autoclean=True)
Adding PreComponentAction type listener.
Definition: RTObject.py:3596
def addPostComponentActionListener(self, listener_type, memfunc, autoclean=True)
Adding PostComponentAction type listener.
Definition: RTObject.py:3716
def removeInPort(self, port)
[local interface] Unregister InPort
Definition: RTObject.py:2805
def find(seq, f)
Return the index of CORBA sequence element that functor matches.
def getProperties(self)
[local interface] Get RTC property
Definition: RTObject.py:2559
def get_owned_contexts(self)
[CORBA interface] Get ExecutionContextList.
Definition: RTObject.py:803
def registerPort(self, port)
[local interface] Register Port
Definition: RTObject.py:2653
def postOnError(self, ec_id, ret)
Definition: RTObject.py:4555
def updateParameters(self, config_set)
void updateParameters(const char* config_set);
Definition: RTObject.py:2613
def on_execute(self, ec_id)
[DataFlowComponentAction CORBA interface] Primary Periodic Operation of RTC
Definition: RTObject.py:1541
def on_state_update(self, ec_id)
[DataFlowComponentAction CORBA interface] Secondary Periodic Operation of RTC
Definition: RTObject.py:1601
def on_rate_changed(self, ec_id)
[DataFlowComponentAction CORBA interface] Notify rate chenged
Definition: RTObject.py:1649
def postOnActivated(self, ec_id, ret)
Definition: RTObject.py:4537
def get_component_profile(self)
[RTObject CORBA interface] Get RTC&#39;s profile
Definition: RTObject.py:897
def postOnReset(self, ec_id, ret)
Definition: RTObject.py:4561
def getExecutionRate(self, ec_id)
[local interface] Getting current context&#39; execution rate
Definition: RTObject.py:3021
def postOnRateChanged(self, ec_id, ret)
Definition: RTObject.py:4579
def removeOutPort(self, port)
[local interface] Unregister OutPort
Definition: RTObject.py:2844
def on_initialize(self)
[ComponentAction CORBA interface] Initialize RTC
Definition: RTObject.py:1138
def copyFromProperties(nv, prop)
Copy to NVList from Proeprties.
Definition: NVUtil.py:85
def getVersion(self)
const char* getVersion()
Definition: RTObject.py:2394
def postOnFinalize(self, ec_id, ret)
Definition: RTObject.py:4519
def postOnStateUpdate(self, ec_id, ret)
Definition: RTObject.py:4573
def addPortConnectListener(self, listener_type, memfunc, autoclean=True)
Adding PortConnect type listener.
Definition: RTObject.py:4019
def attach_context(self, exec_context)
[CORBA interface] Attach ExecutionContext.
Definition: RTObject.py:994
def setObjRef(self, rtobj)
void setObjRef(const RTObject_ptr rtobj);
Definition: RTObject.py:2473
def get_monitoring(self)
[SDO interface] Get Monitoring object
Definition: RTObject.py:2146
def get_device_profile(self)
[SDO interface] Getting SDO DeviceProfile
Definition: RTObject.py:1851
def postOnDeactivated(self, ec_id, ret)
Definition: RTObject.py:4543


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