def applyScript(self, c, indata=None): name,data,fname = c[1:] globals()['rtc_result'] = None globals()['rtc_in_data'] = indata globals()['web_in_data'] = indata # # execute script or script file if fname : ffname = utils.findfile(fname) if ffname : execfile(ffname,globals()) try: if data : exec(data, globals()) except: print data #self._logger.error("Fail to execute script:" + name) # # Call 'send' method of Adaptor to send the result... rtc_result = globals()['rtc_result'] if rtc_result == None : pass else: try: ad = self.adaptors[name] ad.send(name, rtc_result) except KeyError: if name : self._logger.error("no such adaptor:" + name) else: self._logger.error("no such adaptor: None")
def procScript(self, tag, fname): txt = self.getScripts(tag) if fname : ffname = utils.findfile(fname) if ffname : execfile(ffname, globals()) if txt : exec(txt, globals())
def procScript(self, tag, fname, imports): if imports : import_str="import "+imports exec(import_str, eSEAT_Core.getGlobals()) txt = self.getScripts(tag) if fname : ffname = utils.findfile(fname) if ffname : utils.exec_script_file(ffname, eSEAT_Core.getGlobals()) if txt : #sys.path.append('.') exec(txt, eSEAT_Core.getGlobals())
def __init__(self, parent, xsd='seatml.xsd', logger=None): self.parent = parent self.componentName = "eSEAT" if logger: self._logger = parent._logger else: self._logger = None xsd_file = utils.findfile(xsd) print "XSD file '"+xsd+"' = '"+xsd_file+"'." if xsd_file: self.setXsd(xsd_file) else: print "ERROR:XSD file '"+xsd+"' not found." self.include_rules = [] self.seatml_base_dir = ""
def __init__(self, parent, xsd='seatml.xsd', logger=None): self.parent = parent self.componentName = "eSEAT" self._xmlschema = None if logger: self._logger = parent._logger else: self._logger = None xsd_file = utils.findfile(xsd) if xsd_file: self.setXsd(xsd_file) print ("XSD file '"+xsd+"' = '"+xsd_file+"'.") else: #print ("Warining:XSD file '"+xsd+"' not found.") pass self.include_rules = [] self.seatml_base_dir = ""
def processOnDataIn(self, name, data): self._logger.info("got input from %s" % (name,)) cmds = self.lookupWithDefault(self.currentstate, name, "ondata") if not cmds: self._logger.info("no command found") return False for c in cmds: kond = c[0] globals()['rtc_in_data'] = data if kond[0] : ffname = utils.findfile(kond[0]) if ffname : execfile(ffname, globals()) # execfile(kond[0], globals()) if eval(kond[1], globals()): for cmd in c[1]: self.activateCommandEx(cmd, data) return True
sys.path.append(os.path.join(rootdir,'3rd_party')) # # ######## # for OpenRTM-aist import OpenRTM_aist import omniORB from RTC import * ######################################## # eSEAT_Core # #execfile(os.path.join(rootdir,'eSEAT_Core.py')) ffname = utils.findfile('eSEAT_Core.py') if ffname : execfile(ffname) else: print 'eSEAT_Core.py not found' sys.exit(1) ############################################################### # __version__ = "0.3" ######################################################################### # # Sprcification of eSEAT # eseat_spec = ["implementation_id", "eSEAT",