def IntroDataCallBack(data): global dataText, _dialogManager, onLogin rospy.loginfo(rospy.get_caller_id() + "Echoed %s", data.data) dataText = data.data print dataText if _dialogManager == None: _dialogManager = DialogManager(langSelect) if onLogin == True: _dialogManager.SetCurrentSate("LoginState") intent, msgArray = _dialogManager.IntroGreeting("Paula", dataText)
def StartSTTDataCallback(data): global _dialogManager, langSelect rospy.loginfo(rospy.get_caller_id() + "Echoed %s", data.data) startSTT = data.data print startSTT if startSTT: if _dialogManager == None: _dialogManager = DialogManager(langSelect) luisFeed = _dialogManager.STTLanguage() intentName, entityParams = _dialogManager.LUISUnderstand(luisFeed) intentName, msgArray = _dialogManager.StateSwitcher( intentName, entityParams)
def LangDataCallBack(data): global _dialogManager, langSelect rospy.loginfo(rospy.get_caller_id() + "Echoed %s", data.data) langSelect = data.data _dialogManager = DialogManager(langSelect) print langSelect pass
def IntroDataCallBack(data): global dataText, _dialogManager, onLogin rospy.loginfo(rospy.get_caller_id() + "Echoed %s", data.data) dataText = data.data print dataText if _dialogManager == None: _dialogManager = DialogManager(langSelect) if onLogin == True: _dialogManager.SetCurrentSate("LoginState") intentName, msgArray = _dialogManager.IntroGreeting("Paula", dataText) if intentName == "CRUDTodolist" or intentName == "QueryTodoList": queryArray = Int32MultiArray(data=msgArray) #todoListQueryPublisher.publish(queryArray) TodoListPublish(queryArray) elif intentName == "LanguageChange": language = msgArray[0] #_dialogManager.GetCurrentLanguage() languangeChangePublisher.publish(language) else: _dialogManager.SetCurrentSate("DefaultState") onLogin = False
def StartSTTDataCallback(data): global _dialogManager, langSelect rospy.loginfo(rospy.get_caller_id() + "Echoed %s", data.data) startSTT = data.data print startSTT if startSTT: if _dialogManager == None: _dialogManager = DialogManager(langSelect) luisFeed = _dialogManager.STTLanguage() if luisFeed == "": _dialogManager.TTSSpeakLanguage( "My Apologies, I could not understand what was said. Try again." ) intentName, msgArray = "None", [] luisFeed = _dialogManager.STTLanguage() intentName, entityParams = _dialogManager.LUISUnderstand( _dialogManager.TransLateText("english", luisFeed)) intentName, msgArray = _dialogManager.StateSwitcher( intentName, entityParams) else: intentName, entityParams = _dialogManager.LUISUnderstand( _dialogManager.TransLateText("english", luisFeed)) intentName, msgArray = _dialogManager.StateSwitcher( intentName, entityParams) #Switching statement based on intent if intentName == "CRUDTodolist" or intentName == "QueryTodoList": queryArray = Int32MultiArray(data=msgArray) #todoListQueryPublisher.publish(queryArray) TodoListPublish(queryArray) elif intentName == "LanguageChange": language = msgArray[0] #_dialogManager.GetCurrentLanguage() languangeChangePublisher.publish(language) else: pass
from std_msgs.msg import Bool from std_msgs.msg import Int32MultiArray from cv_bridge import CvBridge, CvBridgeError from DialogManagerClass import DialogManager from STTClass import STTClass from TTSClass import TTSClass global numItems, notDoneItems, mealName, drugName, exerciseName, miscName, miscDes global langSelect, startSTT, dataText global onLogin onLogin = False global _dialogManager _dialogManager = DialogManager("english") path = os.path.dirname(os.path.realpath(__file__)) mainPage = os.path.join(path, "..", "..", "scripts", "Index.html") wb.open_new(mainPage) #ttsObject = TTSClass() #sttObject = STTClass() #Call Back Fxns def LangDataCallBack(data): global _dialogManager, langSelect rospy.loginfo(rospy.get_caller_id() + "Echoed %s", data.data) langSelect = data.data _dialogManager = DialogManager(langSelect) print langSelect