def callbackCommandLoadCLIPS(data): print 'LOAD FILE' filePath = data.data if not filePath: print 'OPEN FILE, Click on the botton and select a file to be loaded.' return if filePath[-3:] == 'clp': _clipsLock.acquire() clips.BatchStar(filePath) clipsFunctions.PrintOutput() _clipsLock.release() print 'File Loaded!' return path = os.path.dirname(os.path.abspath(filePath)) f = open(filePath, 'r') line = f.readline() _clipsLock.acquire() while line: clips.BatchStar((path + os.sep + line).strip()) line = f.readline() f.close() clipsFunctions.PrintOutput() _clipsLock.release() print 'Files Loaded!' clipsFunctions.Reset() print 'Facts were reset!' setLogLevelTest()
def init_KDB(req): print 'INIT KDB' print 'LOAD FILE' global file_gpsr rospack = rospkg.RosPack() #file_gpsr = rospack.get_path('simulator') + '/src/rules_base/oracle.dat' if not req.filePath: filePath = file_gpsr else: filepath = rospack.get_path('simulator') #clips.BatchStar(filepath + os.sep + 'CLIPS' + os.sep + 'BB_interface.clp') filePath = filepath + req.filePath #filePath = req.filePath print 'Load file in path' + filePath if filePath[-3:] == 'clp': _clipsLock.acquire() clips.BatchStar(filePath) clipsFunctions.PrintOutput() _clipsLock.release() print 'File Loaded!' return path = os.path.dirname(os.path.abspath(filePath)) f = open(filePath, 'r') line = f.readline() _clipsLock.acquire() while line: clips.BatchStar((path + os.sep + line).strip()) line = f.readline() f.close() clipsFunctions.PrintOutput() _clipsLock.release() print 'Files Loaded!' clipsFunctions.Reset() print 'Facts were reset!' setLogLevelTest() if req.run == True: clipsFunctions.Run('') return InitKDBResponse()
def init_KDB(req): print 'INIT KDB' print 'LOAD FILE' global file_gpsr if not req.filePath: filePath = file_gpsr else: filePath = req.filePath print 'Load file in path' + filePath if filePath[-3:] == 'clp': _clipsLock.acquire() clips.BatchStar(filePath) clipsFunctions.PrintOutput() _clipsLock.release() print 'File Loaded!' return path = os.path.dirname(os.path.abspath(filePath)) f = open(filePath, 'r') line = f.readline() _clipsLock.acquire() while line: clips.BatchStar((path + os.sep + line).strip()) line = f.readline() f.close() clipsFunctions.PrintOutput() _clipsLock.release() print 'Files Loaded!' clipsFunctions.Reset() print 'Facts were reset!' setLogLevelTest() if req.run == True: clipsFunctions.Run('') return InitKDBResponse()
def callbackCommandResetCLIPS(data): clipsFunctions.Reset() print 'Facts were reset!' setLogLevelTest()
def reset(self): clipsFunctions.Reset() print 'Facts were reset!' self.setLogLevel()