def PBMeshSmeshPressed(self):
    from omniORB import CORBA
    import salome
    from salome.kernel import studyedit
    from salome.smesh.smeshstudytools import SMeshStudyTools
    from salome.gui import helper as guihelper
    from salome.smesh import smeshBuilder
    smesh = smeshBuilder.New(salome.myStudy)

    mySObject, myEntry = guihelper.getSObjectSelected()
    if CORBA.is_nil(mySObject) or mySObject==None:
      #QMessageBox.critical(self, "Mesh", "select an input mesh")
      self.LE_MeshSmesh.setText("")
      self.MeshIn=""
      self.LE_MeshFile.setText("")
      self.fichierIn=""
      return
    self.smeshStudyTool = SMeshStudyTools()
    try:
      self.__selectedMesh = self.smeshStudyTool.getMeshObjectFromSObject(mySObject)
    except:
      QMessageBox.critical(self, "Mesh", "select an input mesh")
      return
    if CORBA.is_nil(self.__selectedMesh):
      QMessageBox.critical(self, "Mesh", "select an input mesh")
      return
    myName = mySObject.GetName()
    #print "MeshSmeshNameChanged", myName
    self.MeshIn=myName
    self.LE_MeshSmesh.setText(myName)
    self.LE_MeshFile.setText("")
    self.fichierIn=""
    def onSelectSmeshObject(self):
        '''
        This function is the slot connected on the mesh selection
        button. It memorizes the selected mesh and put its name in the
        text field of the dialog box.
        '''
        mySObject, myEntry = guihelper.getSObjectSelected()
        if CORBA.is_nil(mySObject):
            self.__ui.txtSmeshObject.setText("You must choose a mesh")
            self.__ui.txtGroupName.setText("")
            self.__ui.txtSmeshObject.setEnabled(False)
            self.__ui.btnAddInput.setEnabled(False)
            self.__selectedMesh = None
            return

        self.smeshStudyTool.updateStudy(studyedit.getActiveStudyId())
        self.__selectedMesh = self.smeshStudyTool.getMeshObjectFromSObject(mySObject)
        if CORBA.is_nil(self.__selectedMesh):
            self.__ui.txtSmeshObject.setText("The selected object is not a mesh")
            self.__ui.txtGroupName.setText("")
            self.__ui.txtSmeshObject.setEnabled(False)
            self.__ui.btnAddInput.setEnabled(False)
            self.__selectedMesh = None
            return
        myName = mySObject.GetName()
        self.__ui.txtSmeshObject.setText(myName)
        self.__ui.txtSmeshObject.setEnabled(True)
        self.__ui.btnAddInput.setEnabled(True)

        # We can suggest a default group name from the mesh name
        self.__ui.txtGroupName.setText(myName)
  def destroyRecursive(self, context):
    cont = True
    bl = []
    bi = 0
    bl, bi = context.list(self._blLength)
    while cont:
      for i in range(len(bl)):
        if bl[i].binding_type == CosNaming.ncontext:
          obj = context.resolve(bl[i].binding_name)
          next_context = obj._narrow(CosNaming.NamingContext)

          self.destroyRecursive(next_context)
          context.unbind(bl[i].binding_name)
          next_context.destroy()
        elif bl[i].binding_type == CosNaming.nobject:
          context.unbind(bl[i].binding_name)
        else:
          assert(0)
      if CORBA.is_nil(bi):
        cont = False
      else:
        bi.next_n(self._blLength, bl)

    if not (CORBA.is_nil(bi)):
      bi.destroy()
    return
  def sdoToDFC(self, sdo, dfc):
    if CORBA.is_nil(sdo):
      return False

    dfc[0] = sdo._narrow(OpenRTM.DataFlowComponent)
    if CORBA.is_nil(dfc[0]):
      return False

    return True
Beispiel #5
0
 def _set_money( self, money ):
     try:
         CORBA.id(money)
         currency = getCurrency(money.currencyCode)
         m = Money(0, currency)
         m._setState(money.amount, currency)
         money = m
     except CORBA.BAD_PARAM:
         pass
     
     self._money = money
	def test_getPortRef(self):
		
		getP = self._pa.getPortRef("")
		self.assertEqual(CORBA.is_nil(getP), True)

		getP = self._pa.getPortRef("port1")
		self.assertEqual(CORBA.is_nil(getP), False)
		self.assertEqual(getP.get_port_profile().name, "port1")

		getP = self._pa.getPortRef("port0")
		self.assertEqual(CORBA.is_nil(getP), False)
		self.assertEqual(getP.get_port_profile().name, "port0")
		return
  def subscribeFromIor(self, properties):
    self._rtcout.RTC_TRACE("subscribeFromIor()")
    
    index = OpenRTM_aist.NVUtil.find_index(properties,
                                           "dataport.corba_cdr.inport_ior")
    if index < 0:
      self._rtcout.RTC_ERROR("inport_ior not found")
      return False
    
    ior = ""
    try:
      ior = any.from_any(properties[index].value, keep_structs=True)
    except:
      self._rtcout.RTC_ERROR(sys.exc_info()[0])

    if not ior:
      self._rtcout.RTC_ERROR("inport_ior has no string")
      return False
    
    orb = OpenRTM_aist.Manager.instance().getORB()
    obj = orb.string_to_object(ior)
    
    if CORBA.is_nil(obj):
      self._rtcout.RTC_ERROR("invalid IOR string has been passed")
      return False
    
    if not self.setObject(obj):
      self._rtcout.RTC_WARN("Setting object to consumer failed.")
      return False

    return True
  def onInitialize(self):
    self._rtcout.RTC_TRACE("onInitialize()")

    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")

    mgr = OpenRTM_aist.Manager.instance()
    sdos = []
    for member in self._members[0]:
      if member == "":
        continue

      rtc = mgr.getComponent(member)

      if rtc is None:
        print "no RTC found: ", member
        continue

      sdo = rtc.getObjRef()
      if CORBA.is_nil(sdo):
        continue

      OpenRTM_aist.CORBA_SeqUtil.push_back(sdos, sdo)
    
    try:
      self._org.set_members(sdos)
    except:
      self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())

    return RTC.RTC_OK
  def subscribeFromRef(self, properties):
    self._rtcout.RTC_TRACE("subscribeFromRef()")
    index = OpenRTM_aist.NVUtil.find_index(properties,
                                           "dataport.corba_cdr.inport_ref")
    if index < 0:
      self._rtcout.RTC_ERROR("inport_ref not found")
      return False
    
    obj = None
    try:
      obj = any.from_any(properties[index].value, keep_structs=True)
    except:
      self._rtcout.RTC_ERROR(sys.exc_info()[0])
    
    if not obj:
      self._rtcout.RTC_ERROR("prop[inport_ref] is not objref")
      return False
    
    if CORBA.is_nil(obj):
      self._rtcout.RTC_ERROR("prop[inport_ref] is not objref")
      return False
    
    if not self.setObject(obj):
      self._rtcout.RTC_ERROR("Setting object to consumer failed.")
      return False

    return True
  def addOrganizationToTarget(self, member):
    conf = member._config
    if CORBA.is_nil(conf):
      return

    conf.add_organization(self._objref)
    return
Beispiel #11
0
def getManager():
    """
    Returns a reference to the Manager.
    
    Params: None
    
    Returns: a reference to the Manager (or None if there are network problems).
    
    Raises: Nothing.
    """
    global MGR_REF

    if MGR_REF == None:
        # If this function has never been called before...
        try:
            MGR_REF = getORB().string_to_object(getManagerCorbaloc())
            if MGR_REF != None and (not CORBA.is_nil(MGR_REF)):
                try:
                    MGR_REF._non_existent()
                    MGR_REF = MGR_REF._narrow(Manager)
                except:
                    MGR_REF = None
            else:
                MGR_REF = None
        except Exception, e:
            MGR_REF = None
            print_exc()
 def removeOrganizationFromTarget(self, member):
   # get given RTC's configuration object
   if CORBA.is_nil(member._config):
     return
   
   # set organization to target RTC's conf
   ret = member._config.remove_organization(self._pId)
   return
Beispiel #13
0
    def setObject(self, ior):
      self._ior = ior
      orb = OpenRTM_aist.Manager.instance().getORB()
      obj = orb.string_to_object(ior)
      if CORBA.is_nil(obj):
        return False

      return self._consumer.setObject(obj)
  def init(self, name_server):
    self._nameServer = "corbaloc::" + name_server + "/NameService"
    obj = self._orb.string_to_object(self._nameServer)
    self._rootContext = obj._narrow(CosNaming.NamingContext)
    if CORBA.is_nil(self._rootContext):
      raise MemoryError

    return
 def __call__(self, obj):
   try:
     if CORBA.is_nil(obj):
       print "No service connected."
     else:
       self._result[0] = obj.echo(self._msg)
   except:
     pass
Beispiel #16
0
    def create( self, money):
        try:
            CORBA.id(money)
            currency = getCurrency(money.currencyCode)
            m = Money(money.amount, currency)
            money = m
        except CORBA.BAD_PARAM:
            pass
        
        pk = '%.5f' % time()
        moneyWidget = MoneyWidget(pk)
        moneyWidget._set_money(money)

        self.PersistenceService.create(moneyWidget)

        # Notify our observers that a new entity has been created
        #self._notifyCreate(moneyWidget)
        return moneyWidget
Beispiel #17
0
    def close(self, evt):
        if self.toplevel:
            self.toplevel = None
            try:
                self.game.unwatchGame(self.cookie)
            except CORBA.SystemException, ex:
                print "System exception trying to unwatch game:"
                print "  ", CORBA.id(ex), ex

            id = poa.servant_to_id(self)
            poa.deactivate_object(id)
  def add_component(self, comp):
    self._rtcout.RTC_TRACE("add_component()")
    if CORBA.is_nil(comp):
      return RTC.BAD_PARAMETER
    try:
      dfp_  = comp._narrow(OpenRTM.DataFlowComponent)
      rtc_  = comp._narrow(RTC.RTObject)
      if CORBA.is_nil(dfp_) or CORBA.is_nil(rtc_):
        return RTC.BAD_PARAMETER

      id_   = dfp_.attach_context(self._ref)
      comp_ = self.Comp(ref=comp, dfp=dfp_, id=id_)
      self._comps.append(comp_)
      self._profile.participants.append(rtc_)
      return RTC.RTC_OK
    except CORBA.Exception:
      self._rtcout.RTC_ERROR(sys.exc_info()[0])
      return RTC.BAD_PARAMETER

    return RTC.RTC_OK
Beispiel #19
0
def ListRecursive(context, rtclist, name):
    
    m_blLength = 100
    
    bl = context.list(m_blLength)
    

    cont = True
    while cont:
        for i in bl[0]:
            if i.binding_type == CosNaming.ncontext:
                
                next_context = context.resolve(i.binding_name)
                name_buff = name[:]
                name.append(i.binding_name[0].id)

                
                
                
                
                ListRecursive(next_context,rtclist,name)
                

                name = name_buff
            elif i.binding_type == CosNaming.nobject:
                
                
                if len(rtclist) > m_blLength:
                    break
                if i.binding_name[0].kind == 'rtc':
                    name_buff = name[:]
                    name_buff.append(i.binding_name[0].id)
                    
                    tkm = OpenRTM_aist.CorbaConsumer()
                    tkm.setObject(context.resolve(i.binding_name))
                    inobj = tkm.getObject()._narrow(RTC.RTObject)
                    pin = inobj.get_ports()
                    for p in pin:
                        name_buff2 = name_buff[:]
                        profile = p.get_port_profile()
                        props = nvlist_to_dict(profile.properties)
                        tp_n = profile.name.split('.')[1]
                        name_buff2.append(tp_n)
                        

                        rtclist.append([name_buff2,p])
                        
            else:
                pass
        if CORBA.is_nil(bl[1]):
            cont = False
        else:
            bl = i.next_n(m_blLength)
  def set_owner(self, sdo):
    self._rtcout.RTC_TRACE("set_owner()")
    if CORBA.is_nil(sdo):
      raise SDOPackage.InvalidParameter("set_owner()")

    try:
      self._varOwner = sdo
      return True
    except:
      self._rtcout.RTC_ERROR(sys.exc_info()[0])
      raise SDOPackage.InternalError("set_owner()")

    return True
  def set_owner(self, sdo):
    self.__rtcout.RTC_TRACE("set_owner()")
    if CORBA.is_nil(sdo):
      raise SDOPackage.InvalidParameter("set_owner()")

    try:
      self._varOwner = sdo
      return True
    except:
      self.__rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
      raise SDOPackage.InternalError("set_owner()")

    return True
  def setObject(self, obj):
    if not CorbaConsumerBase.setObject(self, obj):
      self.releaseObject()
      return False

    if self._interfaceType:
      self._var = obj._narrow(self._interfaceType)
    else:
      self._var = self._objref

    if not CORBA.is_nil(self._var):
      return True

    self.releaseObject()
    return False
Beispiel #23
0
    def killGame(self):
        selection = self.listbox.curselection()
        if selection == ():
            return

        index = int(selection[0])
        info = self.gameList[index]

        try:
            info.obj.kill()
            msg = "killed"

        except CORBA.SystemException, ex:
            print "System exception trying to kill game:"
            print "  ", CORBA.id(ex), ex
            msg = "error contacting object"
Beispiel #24
0
    def publishEvent (self,
                      simple_data=None,
                      type_name=None,
                      event_name="",
                      se=None,
                      supplier_name=None):
        '''
        publishEvent is the one method developers have to use.


        Params:
        - simple_data is a user-defined IDL struct. If this parameter is not
        specified by the developer, se MUST be used.  99% of the time developers
        should specify the simple_data parameter and NOTHING ELSE!
        - type_name is literally the type_name field of a structured event. This
        is an optional parameter and should not be specified under normal
        circumstances. If unspecified, the name of the simple_data object is used.
        - event_name is the event_name field of the structured event. Not really
        useful.
        - se is a fully-defined structured event. If this parameter is specified,
        all other parameters will be completely ignored. A check is made to ensure
        that this object is really what it claims to be. This parameter is
        reserved for ACS internal usage.
        - suppier_name is the name of the supplier publishing the event. This
        parameter is reserved for ACS internal usage.

        Returns: Nothing

        Raises:
        - ACSErrTypeCommonImpl.CORBAProblemExImpl
        - ACSErrTypeCommonImpl.CouldntPerformActionExImpl
        - ACSErrTypeCommonImpl.TypeNotSupportedExImpl
        '''
        #Whoah, user passed in the entire structured event...I'm impressed.
        if se != None:
            Supplier.publishEvent(simple_data,type_name,event_name,se, supplier_name)
	
	#User didn't specify type_name.  Assume it's the name of the
        #repository ID. If that doesn't work either, must be a simple
        #CORBA type.
        if (type_name == None) and (simple_data != None):
            try:
                type_name = str(simple_data.__class__.__name__)
            except Exception, e:
                self.logger.logWarning(str(e))
                print_exc()
                type_name = str(CORBA.id(simple_data))
Beispiel #25
0
    def getGameList(self):
        """Get the list of games from the GameFactory, and populate
        the Listbox in the GUI"""

        # To make life interesting, we get the game information
        # structures one at a time from the server. It would be far
        # more sensible to get them many at a time.

        self.gameList = []
        self.listbox.delete(0, END)

        try:
            seq, iterator = self.gameFactory.listGames(0)
        except CORBA.SystemException, ex:
            print "System exception contacting GameFactory:"
            print "  ", CORBA.id(ex), ex
            return
  def remove_component(self, comp):
    self._rtcout.RTC_TRACE("remove_component()")
    len_ = len(self._comps)
    for i in range(len_):
      idx = (len_ - 1) - i
      if self._comps[idx]._ref._is_equivalent(comp):
        self._comps[idx]._ref.detach_context(self._comps[idx]._sm.ec_id)
        del self._comps[idx]
        rtcomp = comp._narrow(RTC.RTObject)
        if CORBA.is_nil(rtcomp):
          self._rtcout.RTC_ERROR("Invalid object reference.")
          return RTC.RTC_ERROR
        OpenRTM_aist.CORBA_SeqUtil.erase_if(self._profile.participants,
                                            self.find_participant(rtcomp))
        return RTC.RTC_OK

    return RTC.BAD_PARAMETER
Beispiel #27
0
 def _connect_to_naming_service(self, address):
     # Try to connect to a name server and get the root naming context.
     with self._mutex:
         self._full_address = 'corbaloc::{0}/NameService'.format(address)
         try:
             self._ns_obj = self._orb.string_to_object(self._full_address)
         except CORBA.ORB.InvalidName:
             raise exceptions.InvalidServiceError(address)
         try:
             root_context = self._ns_obj._narrow(CosNaming.NamingContext)
         except CORBA.TRANSIENT as e:
             if e.args[0] == TRANSIENT_ConnectFailed:
                 raise exceptions.InvalidServiceError(address)
             else:
                 raise
         if CORBA.is_nil(root_context):
             raise exceptions.FailedToNarrowRootNamingError(address)
         return root_context
  def __init__(self, orb, name_server=None):
    self._orb = orb
    self._nameServer = ""
    self._rootContext = CosNaming.NamingContext._nil
    self._blLength = 100

    if name_server:
      self._nameServer = "corbaloc::" + name_server + "/NameService"
      try:
        obj = orb.string_to_object(self._nameServer)
        self._rootContext = obj._narrow(CosNaming.NamingContext)
        if CORBA.is_nil(self._rootContext):
          print "CorbaNaming: Failed to narrow the root naming context."

      except CORBA.ORB.InvalidName:
        print "Service required is invalid [does not exist]."

    return
  def addParticipantToEC(self, member):
    if CORBA.is_nil(self._ec) or self._ec is None:
      ecs = self._rtobj.get_owned_contexts()
      if len(ecs) > 0:
        self._ec = ecs[0]
      else:
        return
    # set ec to target RTC
    ret = self._ec.add_component(member._rtobj)

    orglist = member._rtobj.get_organizations()
    for org in orglist:
      sdos = org.get_members()
      for sdo in sdos:
        dfc = [None]
        if not self.sdoToDFC(sdo, dfc):
          continue
        self._ec.add_component(dfc[0])
    return
  def removeParticipantFromEC(self, member):
    if CORBA.is_nil(self._ec) or self._ec is None:
      ecs = self._rtobj.get_owned_contexts()
      if len(ecs) > 0:
        self._ec = ecs[0]
      else:
        self._rtcout.RTC_FATAL("no owned EC")
        return
    self._ec.remove_component(member._rtobj)

    orglist = member._rtobj.get_organizations()

    for org in orglist:
      sdos = org.get_members()
      for sdo in sdos:
        dfc = [None]
        if not self.sdoToDFC(sdo, dfc):
          continue
        self._ec.remove_component(dfc[0])
    return
Beispiel #31
0
 def setCameraParameterToDefault(self, id):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
Beispiel #32
0
#!/usr/bin/env python

import sys
import CosNaming
from omniORB import CORBA, any
from fr.upem.robot import *

nsref = open(sys.argv[1], 'r')
ior = "NameService=" + nsref.read()
orb = CORBA.ORB_init(["-ORBInitRef", ior], CORBA.ORB_ID)

ref = orb.resolve_initial_references("NameService")
namingContext = ref._narrow(CosNaming.NamingContext)

nameRobotPilote = namingContext.to_name("RobotContext/RobotPilote")
nameRobotControl = namingContext.to_name("RobotContext/RobotControl")

objRobotPilote = namingContext.resolve(nameRobotPilote)
objRobotControl = namingContext.resolve(nameRobotControl)

robotPilote = objRobotPilote._narrow(namingContext.resolve(nameRobotPilote))
robotControl = objRobotControl._narrow(namingContext.resolve(nameRobotControl))

if robotPilote is None:
    print "Object reference is not an Example::Echo"
    sys.exit(1)
if robotControl is None:
    print "Object reference is not an Example::Echo"
    sys.exit(1)

try:
Beispiel #33
0
 def __init__(self, value):
     if value not in ImplicitActivationPolicyValue._items:
         raise CORBA.PolicyError(CORBA.BAD_POLICY_VALUE)
     self._value = value
     self._policy_type = 20
Beispiel #34
0
 def set_value(self, value):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
Beispiel #35
0
 def echo(self, msg):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
Beispiel #36
0
            else:
                raise TypeNotSupportedExImpl(nvSeq=[
                    NameValue("channelname", self.channelName),
                    NameValue("reason", "Not a structured event")
                ])

        #User didn't specify type_name.  Assume it's the name of the
        #repository ID. If that doesn't work either, must be a simple
        #CORBA type.
        if (type_name == None) and (simple_data != None):
            try:
                type_name = str(simple_data.__class__.__name__)
            except Exception, e:
                self.logger.logWarning(str(e))
                print_exc()
                type_name = str(CORBA.id(simple_data))
        elif (simple_data == None):
            raise CouldntPerformActionExImpl(nvSeq=[
                NameValue("channelname", self.channelName),
                NameValue("reason", "Empty data")
            ])

        #create the CORBA Any in the "normal" manner first.  If this
        #fails, try omniORB's any helper module designed for simple types.
        try:
            corba_any = CORBA.Any(CORBA.TypeCode(CORBA.id(simple_data)),
                                  simple_data)
        except Exception, e:
            self.logger.logTrace(str(e))
            try:
                corba_any = any.to_any(simple_data)
Beispiel #37
0
 def getGain(self):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
Beispiel #38
0
 def setGain(self, gain):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
Beispiel #39
0
 def __init__(self, value):
     if value not in ServantRetentionPolicyValue._items:
         raise CORBA.PolicyError(CORBA.BAD_POLICY_VALUE)
     self._value = value
     self._policy_type = 21
Beispiel #40
0
 def unknown_adapter(self, parent, name):
     raise CORBA.NO_IMPLEMENT(omniORB.NO_IMPLEMENT_NoPythonMethod,
                              CORBA.COMPLETED_NO)
Beispiel #41
0
 def __init__(self, value):
     if value not in RequestProcessingPolicyValue._items:
         raise CORBA.PolicyError(CORBA.BAD_POLICY_VALUE)
     self._value = value
     self._policy_type = 22
Beispiel #42
0
 def preinvoke(self, oid, adapter, operation):
     raise CORBA.NO_IMPLEMENT(omniORB.NO_IMPLEMENT_NoPythonMethod,
                              CORBA.COMPLETED_NO)
Beispiel #43
0
 def etherialize(self, oid, adapter, serv, cleanup_in_progress,
                 remaining_activations):
     raise CORBA.NO_IMPLEMENT(omniORB.NO_IMPLEMENT_NoPythonMethod,
                              CORBA.COMPLETED_NO)
Beispiel #44
0
 def setLifterTime(self, MoveTime):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
Beispiel #45
0
        raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
        # *** Implement me
        # Must return: result

    # ValueList get_value_history()
    def get_value_history(self):
        raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
        # *** Implement me
        # Must return: result


if __name__ == "__main__":
    import sys

    # Initialise the ORB
    orb = CORBA.ORB_init(sys.argv)

    # As an example, we activate an object in the Root POA
    poa = orb.resolve_initial_references("RootPOA")
    # Create an instance of a servant class
    servant = MyService_i()
    # Activate it in the Root POA
    poa.activate_object(servant)
    # Get the object reference to the object
    objref = servant._this()

    # Print a stringified IOR for it
    print orb.object_to_string(objref)
    # Activate the Root POA's manager
    poa._get_the_POAManager().activate()
    # Run the ORB, blocking this thread
Beispiel #46
0
 def sendLifterPose(self, targetLifterPose):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
Beispiel #47
0
 def get_echo_history(self):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
Beispiel #48
0
 def getLifterPose(self):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
Beispiel #49
0
 def get_value(self):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
Beispiel #50
0
 def checkState(self):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
Beispiel #51
0
 def __init__(self, value):
     if value not in IdAssignmentPolicyValue._items:
         raise CORBA.PolicyError(CORBA.BAD_POLICY_VALUE)
     self._value = value
     self._policy_type = 19
Beispiel #52
0
 def checkArrived(self):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
 def objIsNamingContext(self, obj):
   nc = obj._narrow(CosNaming.NamingContext)
   if CORBA.is_nil(nc):
     return False
   else:
     return True
Beispiel #54
0
 def setPositionParam(self, targetPose):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
Beispiel #55
0
 def getCameraParameter(self, id):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
Beispiel #56
0
 def moveStart(self):
     raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO)
Beispiel #57
0
        try:
            print 'getLength called'
            length = 10
        except globaldefs_idl.ProcessingFailureException, ex:
            print ex
        return length

    def destroy(self):
        try:
            print 'destroy called'
        except globaldefs_idl.ProcessingFailureException, ex:
            print ex


# Initialise the ORB and find the root POA
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
poa = orb.resolve_initial_references("RootPOA")

# Create an instance of ASAPIterator_I_i and an Echo object reference
ob = ASAPIterator_I_i()
eo = ob._this()

# Obtain a reference to the root naming context
obj = orb.resolve_initial_references("NameService")
print orb.object_to_string(obj)
rootContext = obj._narrow(CosNaming.NamingContext)

if rootContext is None:
    print "Failed to narrow the root naming context"
    sys.exit(1)
Beispiel #58
0
def main():

    # subscription type
    subs_type = "Flush"

    # initialization of ORB
    orb = CORBA.ORB_init(sys.argv)

    # get NamingService
    naming = OpenRTM_aist.CorbaNaming(orb, "localhost")

    conin = OpenRTM_aist.CorbaConsumer()
    conout = OpenRTM_aist.CorbaConsumer()

    ec0 = OpenRTM_aist.CorbaConsumer(
        interfaceType=OpenRTM.ExtTrigExecutionContextService)
    ec1 = OpenRTM_aist.CorbaConsumer(
        interfaceType=OpenRTM.ExtTrigExecutionContextService)

    # find ConsoleIn0 component
    conin.setObject(naming.resolve("ConsoleIn0.rtc"))

    # get ports
    inobj = conin.getObject()._narrow(RTC.RTObject)
    pin = inobj.get_ports()
    pin[0].disconnect_all()

    # activate ConsoleIn0
    eclisti = inobj.get_owned_contexts()
    eclisti[0].activate_component(inobj)
    ec0.setObject(eclisti[0])

    # find ConsoleOut0 component
    conout.setObject(naming.resolve("ConsoleOut0.rtc"))

    # get ports
    outobj = conout.getObject()._narrow(RTC.RTObject)
    pout = outobj.get_ports()
    pout[0].disconnect_all()

    # activate ConsoleOut0
    eclisto = outobj.get_owned_contexts()
    eclisto[0].activate_component(outobj)
    ec1.setObject(eclisto[0])

    # connect ports
    conprof = RTC.ConnectorProfile("connector0", "", [pin[0], pout[0]], [])
    OpenRTM_aist.CORBA_SeqUtil.push_back(
        conprof.properties,
        OpenRTM_aist.NVUtil.newNV("dataport.interface_type", "corba_cdr"))

    OpenRTM_aist.CORBA_SeqUtil.push_back(
        conprof.properties,
        OpenRTM_aist.NVUtil.newNV("dataport.dataflow_type", "push"))

    OpenRTM_aist.CORBA_SeqUtil.push_back(
        conprof.properties,
        OpenRTM_aist.NVUtil.newNV("dataport.subscription_type", subs_type))

    ret = pin[0].connect(conprof)

    while 1:
        try:
            print "\n\n"
            print "0: tick ConsoleIn component"
            print "1: tick ConsoleOut component"
            print "2: tick both components"
            print "q: exit"
            print "cmd? >",
            cmd = str(sys.stdin.readline())
            if cmd == "0\n":
                ec0._ptr().tick()
            elif cmd == "1\n":
                ec1._ptr().tick()
            elif cmd == "2\n":
                ec0._ptr().tick()
                ec1._ptr().tick()
            elif cmd == "q\n":
                print "exit"
                break

        except:
            print "Exception."
            pass
Beispiel #59
0
 def postinvoke(self, oid, adapter, operations, the_cookie, the_servant):
     raise CORBA.NO_IMPLEMENT(omniORB.NO_IMPLEMENT_NoPythonMethod,
                              CORBA.COMPLETED_NO)
Beispiel #60
0
 def incarnate(self, oid, adapter):
     raise CORBA.NO_IMPLEMENT(omniORB.NO_IMPLEMENT_NoPythonMethod,
                              CORBA.COMPLETED_NO)