HRPCommon.py
Go to the documentation of this file.
1 #
2 # Inherit and use this for individual robots.
3 #
4 import sys
5 
6 import hrp
7 
8 class HRPCommon:
9 
10  def __init__(self, h, p='2809'):
11 
12  self.MotionSys = None
13 
14  self.Hostname = h
15  self.PortNumber = p
16 
17  self.Initialise = 0
18 
19 
20  def initialisePlugins(self):
21  count = 0
22  for pn,vn,pc in plist:
23  if self.Initialise and 1<<count:
24  print 'initialise ', pn, ' as ', vn
25 
26  #
27  # pCORBA: plugin corba name
28  # pFile: plugin shared object file name(without suffix)
29  # pClass: plugin class name
30  #
31  def loadAndCreatePlugin(self, pCORBA, pFile, pClass):
32  p = hrp.findPlugin(pCORBA)
33 
34  if p == None:
35  print 'load and create'
36  self.MotionSys.load(pFile)
37  p = self.MotionSys.create(pFile, pCORBA, '')
38 
39  if p != None:
40  if pClass != None:
41  narrowedP = hrp.doNarrow(pClass, p)
42 
43  else:
44  narrowedP = hrp.doNarrow(Plugin, p)
45  #
46  return narrowedP
47 
48  else:
49  print 'plugin '+pCORBA+' does not exist'
50  return None
def findPlugin(name, rnc=None)
Definition: hrp.py:52
def __init__(self, h, p='2809')
Definition: HRPCommon.py:10
def initialisePlugins(self)
Definition: HRPCommon.py:20
def loadAndCreatePlugin(self, pCORBA, pFile, pClass)
Definition: HRPCommon.py:31


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:38