HRPCommon.py
Go to the documentation of this file.
00001 #
00002 # Inherit and use this for individual robots.
00003 #
00004 import sys
00005 
00006 import hrp
00007 
00008 class HRPCommon:
00009 
00010     def __init__(self, h, p='2809'):
00011 
00012         self.MotionSys = None
00013 
00014         self.Hostname = h
00015         self.PortNumber = p
00016 
00017         self.Initialise = 0
00018 
00019 
00020     def initialisePlugins(self):
00021         count = 0
00022         for pn,vn,pc in plist:
00023             if self.Initialise and 1<<count:
00024                 print 'initialise ', pn, ' as ', vn
00025 
00026     #
00027     # pCORBA: plugin corba name
00028     # pFile:  plugin shared object file name(without suffix)
00029     # pClass: plugin class name
00030     #
00031     def loadAndCreatePlugin(self, pCORBA, pFile, pClass):
00032         p = hrp.findPlugin(pCORBA)
00033 
00034         if p == None:
00035             print 'load and create'
00036             self.MotionSys.load(pFile)
00037             p = self.MotionSys.create(pFile, pCORBA, '')
00038 
00039         if p != None:
00040             if pClass != None:
00041                 narrowedP = hrp.doNarrow(pClass, p)
00042                 
00043             else:
00044                 narrowedP = hrp.doNarrow(Plugin, p)
00045             #
00046             return narrowedP
00047 
00048         else:
00049             print 'plugin '+pCORBA+' does not exist'
00050             return None


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sun Apr 2 2017 03:43:54